Skip to content

Commit

Permalink
change celery setup
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Aug 21, 2024
1 parent 8446e1d commit 8cac18f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
10 changes: 6 additions & 4 deletions meta_edc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import os
from importlib.metadata import PackageNotFoundError, version

from .celery.debug import app as celery_debug
from .celery.live import app as celery_live
from .celery.uat import app as celery_uat
from .celery import app as celery_app

# from .celery.live import app as celery_live
# from .celery.uat import app as celery_uat

try:
__version__ = version(os.getcwd().split(os.sep)[-1])
except PackageNotFoundError:
__version__ = None


__all__ = ["celery_live", "celery_uat", "celery_debug", "__version__"]
# __all__ = ["celery_live", "celery_uat", "celery_debug", "__version__"]
__all__ = ["__version__", "celery_app"]
15 changes: 15 additions & 0 deletions meta_edc/celery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from celery import Celery

# load settings
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meta_edc.settings.debug")

# config celery
# remember to include additional apps with tasks
app = Celery("meta_edc", include=["meta_reports"])
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task(self):
print("Request: {0!r}".format(self.request))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8cac18f

Please sign in to comment.