Skip to content

Commit 47669b9

Browse files
committed
fix celery detection
1 parent c9a8825 commit 47669b9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

deploy_prod.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ gunicorn --workers=2 \
6161
pythonkr_backend.wsgi
6262

6363
# start celery worker with beat
64-
celery -A pythonkr_backend multi start worker1 -c2 -B \
64+
celery -A pythonkr_backend multi start worker -c2 -B \
6565
--loglevel=info \
6666
--pidfile=/home/pk/celery-%n.pid \
6767
--logfile=/home/pk/logs/celery-%n-%i.log

pythonkr_backend/pythonkr_backend/settings/prod.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@
6161
# check WSGI environment
6262
IS_PRODUCTION_SERVER = os.environ.get('IS_WSGI_ENVIRONMENT', 'False') == 'True'
6363

64+
IN_CELERY_WORKER_PROCESS = sys.argv and 'worker' in sys.argv
65+
66+
if IN_CELERY_WORKER_PROCESS:
67+
print('Im in Celery worker')
68+
6469
# logfire settings
6570
if IS_PRODUCTION_SERVER:
6671
logfire.configure(environment='prod', service_name="web", service_version=sha_service_version)
6772
logfire.instrument_django()
6873
logfire.instrument_system_metrics()
69-
#logfire.instrument_psycopg('psycopg')
74+
#logfire.instrument_psycopg('psycopg')
7075
print(f"sys.argv: {sys.argv}")
7176

7277
# celery

0 commit comments

Comments
 (0)