Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions collector_db/StatementComposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from sqlalchemy import Select, select, exists, Table, func, Subquery, and_
from sqlalchemy.orm import aliased

from collector_db.enums import URLMetadataAttributeType, ValidationStatus
from collector_db.enums import URLMetadataAttributeType, ValidationStatus, TaskType

Check warning on line 6 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L6 <401>

'collector_db.enums.URLMetadataAttributeType' imported but unused
Raw output
./collector_db/StatementComposer.py:6:1: F401 'collector_db.enums.URLMetadataAttributeType' imported but unused

Check warning on line 6 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L6 <401>

'collector_db.enums.ValidationStatus' imported but unused
Raw output
./collector_db/StatementComposer.py:6:1: F401 'collector_db.enums.ValidationStatus' imported but unused
from collector_db.models import URL, URLHTMLContent, AutomatedUrlAgencySuggestion, URLOptionalDataSourceMetadata, Batch, \
ConfirmedURLAgency
ConfirmedURLAgency, LinkTaskURL, Task
from collector_manager.enums import URLStatus, CollectorType
from core.enums import BatchStatus


class StatementComposer:
Expand All @@ -16,11 +17,19 @@

@staticmethod
def pending_urls_without_html_data() -> Select:
return (select(URL).
outerjoin(URLHTMLContent).
where(URLHTMLContent.id == None).
where(URL.outcome == URLStatus.PENDING.value))
subquery = (select(1).
select_from(LinkTaskURL).

Check failure on line 21 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L21 <127>

continuation line over-indented for visual indent
Raw output
./collector_db/StatementComposer.py:21:22: E127 continuation line over-indented for visual indent
join(Task, LinkTaskURL.task_id == Task.id).

Check failure on line 22 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L22 <127>

continuation line over-indented for visual indent
Raw output
./collector_db/StatementComposer.py:22:22: E127 continuation line over-indented for visual indent
where(LinkTaskURL.url_id == URL.id).

Check failure on line 23 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L23 <127>

continuation line over-indented for visual indent
Raw output
./collector_db/StatementComposer.py:23:22: E127 continuation line over-indented for visual indent
where(Task.task_type == TaskType.HTML.value).

Check failure on line 24 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L24 <127>

continuation line over-indented for visual indent
Raw output
./collector_db/StatementComposer.py:24:22: E127 continuation line over-indented for visual indent
where(Task.task_status == BatchStatus.COMPLETE.value)

Check failure on line 25 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L25 <127>

continuation line over-indented for visual indent
Raw output
./collector_db/StatementComposer.py:25:22: E127 continuation line over-indented for visual indent
)

Check failure on line 26 in collector_db/StatementComposer.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] collector_db/StatementComposer.py#L26 <124>

closing bracket does not match visual indentation
Raw output
./collector_db/StatementComposer.py:26:22: E124 closing bracket does not match visual indentation

query = select(URL).where(
~exists(subquery)
)

return query


@staticmethod
Expand Down
1 change: 0 additions & 1 deletion security_manager/SecurityManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def __init__(
def validate_token(self, token: str) -> AccessInfo:
try:
payload = jwt.decode(token, self.secret_key, algorithms=[ALGORITHM])
print(payload)
return self.payload_to_access_info(payload)
except InvalidTokenError as e:
raise HTTPException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def test_example_collector(api_test_helper):
# Temporarily disable task trigger
disable_task_trigger(ath)

logger = AsyncCoreLogger(adb_client=AsyncDatabaseClient())
logger = AsyncCoreLogger(adb_client=AsyncDatabaseClient(), flush_interval=1)
await logger.__aenter__()
ath.async_core.collector_manager.logger = logger

Expand Down Expand Up @@ -93,7 +93,7 @@ async def test_example_collector_error(api_test_helper, monkeypatch):
"""
ath = api_test_helper

logger = AsyncCoreLogger(adb_client=AsyncDatabaseClient())
logger = AsyncCoreLogger(adb_client=AsyncDatabaseClient(), flush_interval=1)
await logger.__aenter__()
ath.async_core.collector_manager.logger = logger

Expand Down