인프런 커뮤니티 질문&답변

bluebamus님의 프로필 이미지

작성한 질문수

실리콘밸리 엔지니어와 함께하는 샐러리(Celery)

Task 에러를 Signal로 해결해 보기

product level에서 celeryd를 사용하시나요?

24.07.10 01:23 작성

·

91

0

명령어가 아닌, docker 컨테이너에서 데몬으로 만들어 사용해 보려고 celeryd를

https://celery-safwan.readthedocs.io/en/latest/userguide/daemonizing.html

위 레퍼런스를 따라 설정을 해보았는데 이틀동안 작업을 해보았지만, 결코 celery가 작업을 가져가지 않더라고요.

혹시 사용해 보신적이 있다면 제가 사용한 설정 내용에서 오류가 있는지 확인을 부탁드려도 될까요?

# Names of nodes to start
#   most people will only start one node:
CELERYD_NODES="worker1"
#   but you can also start multiple and configure settings
#   for each in CELERYD_OPTS
#CELERYD_NODES="worker1 worker2 worker3"
#   alternatively, you can specify the number of nodes to start:
#CELERYD_NODES=10

# Absolute or relative path to the 'celery' command:
CELERY_BIN="/usr/local/bin/celery"
#CELERY_BIN="/virtualenvs/def/bin/celery"

# App instance to use
# comment out this line if you don't use an app
CELERY_APP="config"
# or fully qualified:
#CELERY_APP="proj.tasks:app"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="config.settings.dev"

# Where to chdir at start.
CELERYD_CHDIR="/www/test-project"
CELERYBEAT_CHDIR="/www/test-project"

# Extra command-line arguments to the worker
CELERYD_OPTS="--time-limit=300 --concurrency=2"
# Configure node-specific settings by appending node name to arguments:
#CELERYD_OPTS="--time-limit=300 -c 8 -c:worker2 4 -c:worker3 2 -Ofair:worker1"

# Set logging level to DEBUG
#CELERYD_LOG_LEVEL="DEBUG"

# Name of the celery config module.
# CELERY_CONFIG_MODULE="config.celery"

CELERYD_LOG_LEVEL="INFO"

# %n will be replaced with the nodename.
CELERYD_LOG_FILE="/log/gunicorn/celery/celery-%n%I.log"
CELERYD_PID_FILE="/log/gunicorn/celery/celery-run-%n.pid"
CELERYBEAT_LOG_FILE="/log/gunicorn/celerybeat/celerybeat.log"
CELERYBEAT_PID_FILE="/log/gunicorn/celerybeat/celerybeat-run.pid"

# Workers should run as an unprivileged user.
CELERYD_USER="root"
CELERYD_GROUP="root"

# If enabled pid and log directories will be created if missing,
# and owned by the userid/group configured.
CELERY_CREATE_DIRS=1

답변 1

0

미쿡엔지니어님의 프로필 이미지
미쿡엔지니어
지식공유자

2024. 07. 10. 14:01

안녕하세요 bluebamus님,

Production에서는 저는 이런식으로 사용하지 않고, https://github.com/dimz119/learn-celery/blob/main/django_celery/docker-compose.yml#L80 여기처럼 커맨드를 k8s command에서 돌려서 사용하거나, Supervisord를 사용해서 Docker안에서 돌리고 있습니다만, 각자만의 방식이 있고, 워낙 전체적으로 에러를 보면서 해야되기 때문에 제가 딱히 도움을 드릴 수가 없네요.

bluebamus님의 프로필 이미지
bluebamus
질문자

2024. 07. 11. 13:59

감사합니다. Production 보다는 공식 문서에 제공되는 정보라 학습을 하면서 해결이 안되던 부분이었습니다. 말씀대로 Production에서는 커멘드를 사용하는게 맞다고 생각 합니다. ^^