I have a implemented a python command which starts celery
@click.command("tasks", help="run this command to start celery task queue")
def tasks():
"""
Runs the celery task queue
"""
from celery.bin import worker
try:
worker = worker.worker(app=app.config.get("task_app"))
worker.run(app="my_app.task_queue", loglevel="info", uid=os.environ["uid"])
except Exception as e:
raise e
I need to create a similar command which starts celery beat and I had the following approach
@click.command("beat", help="run this command to start beat")
def beat():
try:
p = app.config.get("task_app") # gets the current
command = CeleryCommand()
lst = ["celery", "beat"]
command.execute_from_commandline(lst)
except Exception as e:
raise e
the --app parameter will not work with this approach. Is there a way to make this command programmatically work celery -A proj beat
without passing from command line?