Skip to content

Commit

Permalink
Move celery to tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomilov committed Jan 31, 2025
1 parent 1338b6b commit 4375704
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion h/cli/commands/celery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import click

from h.celery import start
from h.tasks.celery import start


@click.command(
Expand Down
2 changes: 1 addition & 1 deletion h/tasks/annotations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from h.celery import celery, get_task_logger
from h.db.types import URLSafeUUID
from h.models import Annotation
from h.services.annotation_write import AnnotationWriteService
from h.tasks.celery import celery, get_task_logger

log = get_task_logger(__name__)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion h/tasks/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sqlalchemy import func, select

from h import models
from h.celery import celery, get_task_logger
from h.tasks.celery import celery, get_task_logger

log = get_task_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion h/tasks/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import newrelic
from celery import Task

from h.celery import celery, get_task_logger
from h.services import AnnotationSyncService
from h.tasks.celery import celery, get_task_logger

log = get_task_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion h/tasks/job_queue.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from h.celery import celery, get_task_logger
from h.tasks.celery import celery, get_task_logger

log = get_task_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion h/tasks/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pyramid_mailer
import pyramid_mailer.message

from h.celery import celery, get_task_logger
from h.tasks.celery import celery, get_task_logger

__all__ = ("send",)

Expand Down
2 changes: 1 addition & 1 deletion h/tasks/url_migration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from h.celery import celery
from h.tasks.celery import celery


@celery.task(rate_limit="10/m")
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/h/celery_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from billiard.einfo import ExceptionInfo

from h import celery
from h.tasks import celery


class TestCelery:
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_transaction_abort_aborts_request_transaction(self):
sender.app.request.tm.abort.assert_called_once_with()

def test_report_failure_reports_failure_in_debug_mode(self, patch):
log = patch("h.celery.log")
log = patch("h.tasks.celery.log")
sender = mock.Mock(spec=["app"])
sender.name = "wibble"
sender.app.request.debug = True
Expand All @@ -62,7 +62,7 @@ def test_report_failure_reports_failure_in_debug_mode(self, patch):
assert log.error.called

def test_report_failure_skipped_when_not_in_debug_mode(self, patch):
log = patch("h.celery.log")
log = patch("h.tasks.celery.log")
sender = mock.Mock(spec=["app"])
sender.name = "wibble"
sender.app.request.debug = False
Expand Down

0 comments on commit 4375704

Please sign in to comment.