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
1 change: 0 additions & 1 deletion src/api/endpoints/url/get/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from sqlalchemy import select, exists, RowMapping, func
from sqlalchemy.dialects.postgresql import aggregate_order_by
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload

from src.api.endpoints.url.get.dto import GetURLsResponseInfo, GetURLsResponseErrorInfo, GetURLsResponseInnerInfo
from src.db.client.helpers import add_standard_limit_and_offset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self):
URL,
URL.id == DSAppLinkDataSource.url_id,
)
.outerjoin(
.join(
URLRecordType,
URL.id == URLRecordType.url_id,
)
Expand Down
9 changes: 6 additions & 3 deletions src/core/tasks/url/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ async def _run_task(self, entry: URLTaskEntry) -> None:
while meets_prereq:
print(f"Running {operator.task_type.value} Task")
if count > TASK_REPEAT_THRESHOLD:
message = f"Task {operator.task_type.value} has been run more than {TASK_REPEAT_THRESHOLD} times in a row. Task loop terminated."
print(message)
await self.handler.post_to_discord(message=message)
await self._alert_task_repeat_threshold_exceeded(operator)
break
run_info: TaskOperatorRunInfo = await operator.run_task()
await self.conclude_task(run_info)
Expand All @@ -63,6 +61,11 @@ async def _run_task(self, entry: URLTaskEntry) -> None:
count += 1
meets_prereq = await operator.meets_task_prerequisites()

async def _alert_task_repeat_threshold_exceeded(self, operator):
message = f"Task {operator.task_type.value} has been run more than {TASK_REPEAT_THRESHOLD} times in a row. Task loop terminated."
print(message)
await self.handler.post_to_discord(message=message)

async def trigger_task_run(self) -> None:
await self.task_trigger.trigger_or_rerun()

Expand Down
3 changes: 2 additions & 1 deletion src/db/models/impl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

from .link.location_batch.sqlalchemy import LinkLocationBatch
from .link.batch_url.sqlalchemy import LinkBatchURL
from .link.batch_url.sqlalchemy import LinkBatchURL

Check warning on line 3 in src/db/models/impl/__init__.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/db/models/impl/__init__.py#L3 <401>

'.link.batch_url.sqlalchemy.LinkBatchURL' imported but unused
Raw output
./src/db/models/impl/__init__.py:3:1: F401 '.link.batch_url.sqlalchemy.LinkBatchURL' imported but unused
from .anon_session.sqlalchemy import AnonymousSession

Check warning on line 4 in src/db/models/impl/__init__.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/db/models/impl/__init__.py#L4 <401>

'.anon_session.sqlalchemy.AnonymousSession' imported but unused
Raw output
./src/db/models/impl/__init__.py:4:1: F401 '.anon_session.sqlalchemy.AnonymousSession' imported but unused

Check warning on line 4 in src/db/models/impl/__init__.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/db/models/impl/__init__.py#L4 <292>

no newline at end of file
Raw output
./src/db/models/impl/__init__.py:4:54: W292 no newline at end of file
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

Check warning on line 1 in tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py#L1 <100>

Missing docstring in public module
Raw output
./tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py:1:1: D100 Missing docstring in public module

from src.core.tasks.scheduled.impl.sync_to_ds.impl.data_sources.update.queries.prereq import \
DSAppSyncDataSourcesUpdatePrerequisitesQueryBuilder
from src.db.client.async_ import AsyncDatabaseClient


@pytest.mark.asyncio
async def test_prereq(adb_client_test: AsyncDatabaseClient):

Check warning on line 9 in tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py#L9 <103>

Missing docstring in public function
Raw output
./tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py:9:1: D103 Missing docstring in public function
await adb_client_test.run_query_builder(
DSAppSyncDataSourcesUpdatePrerequisitesQueryBuilder()
)

Check warning on line 13 in tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py#L13 <391>

blank line at end of file
Raw output
./tests/manual/core/tasks/scheduled/ds_app_sync/data_sources/update/test_prereq.py:13:1: W391 blank line at end of file