brash-glass-61350
05/03/2024, 10:29 AM# tasks.py
from celery import Celery
app = Celery('tasks', broker='<pyamqp://guest@localhost//>')
@app.task
def add(x, y):
return x + y
python_source(
name="tasks",
source="tasks.py",
dependencies=[
"third_party:requirements#celery",
],
)
pex_binary(
name="celery_app",
script="celery",
dependencies=[":tasks"],
layout="packed",
execution_mode="venv",
)
One is supposed to call celery as follows: celery -A tasks worker. Setting script="celery" on the pex_binary definition takes care of that. I package with pants package but when I call:
celery_app.pex/__main__.py -A tasks worker
I get:
Unable to load celery application.
The module tasks was not found.
What am I missing? How do I tell it to load tasks.py?broad-processor-92400
05/03/2024, 12:22 PMbrash-glass-61350
05/07/2024, 1:15 PM