Skip to content

Commit

Permalink
fix: unblock latest shared change from breaking worker
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry committed Dec 6, 2024
1 parent 808841f commit 6dfaa73
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
7 changes: 0 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import logging
import logging.config
import os

import django
from celery import Celery, signals

from helpers.logging_config import get_logging_config_dict
Expand All @@ -13,11 +11,6 @@
_config_dict = get_logging_config_dict()
logging.config.dictConfig(_config_dict)

# we're moving this before we create the Celery object
# so that celery can detect Django is being used
# using the Django fixup will help fix some database issues
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_scaffold.settings")
django.setup()

celery_app = Celery("tasks")
celery_app.config_from_object("celery_config:CeleryWorkerConfig")
Expand Down
46 changes: 28 additions & 18 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
# -*- coding: utf-8 -*-
import logging
import os
import sys
import typing

import click
import shared.storage
from celery.signals import worker_process_shutdown
from prometheus_client import REGISTRY, CollectorRegistry, multiprocess
from shared.celery_config import BaseCeleryConfig
from shared.config import get_config
from shared.license import startup_license_logging
from shared.metrics import start_prometheus
from shared.storage.exceptions import BucketAlreadyExistsError

import app
from helpers.environment import get_external_dependencies_folder
from helpers.version import get_current_version

import django

# we're moving this before we create the Celery object
# so that celery can detect Django is being used
# using the Django fixup will help fix some database issues
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_scaffold.settings")
django.setup()

# -*- coding: utf-8 -*-
import logging # noqa: E402
import os # noqa: E402
import sys # noqa: E402
import typing # noqa: E402

import click # noqa: E402
import shared.storage # noqa: E402
from celery.signals import worker_process_shutdown # noqa: E402
from prometheus_client import REGISTRY, CollectorRegistry, multiprocess # noqa: E402
from shared.celery_config import BaseCeleryConfig # noqa: E402
from shared.config import get_config # noqa: E402
from shared.license import startup_license_logging # noqa: E402
from shared.metrics import start_prometheus # noqa: E402
from shared.storage.exceptions import BucketAlreadyExistsError # noqa: E402

import app # noqa: E402
from helpers.environment import get_external_dependencies_folder # noqa: E402
from helpers.version import get_current_version # noqa: E402

log = logging.getLogger(__name__)

Expand Down

0 comments on commit 6dfaa73

Please sign in to comment.