ZeitOnline / celery_longterm_scheduler

Schedules celery tasks to run in the potentially far future
BSD 3-Clause "New" or "Revised" License
26 stars 8 forks source link

Need help scheduling tasks from different projects to the same database #13

Open emilio-cea opened 10 months ago

emilio-cea commented 10 months ago

I am trying to schedule tasks for the future on two projects using the same Redis database as a backend.

These projects have different names and I noticed that the task that is stored contains information about the project's module name say, for example, project1.task1 and project2.task2 as well as the rest of the arguments needed to execute the task.

I have 2 tasks that are due on the database, 1 for each project. If I then call the scheduler on project 1 like so

celery -A project1 longterm_scheduler

it fails to send the task that belongs to the other project throwing a ModuleNotFoundError: No module named 'project2'. This also happens the other way around of course, project2 fails to send the tasks belonging to project1.

Is there a way to make these projects share the same database? I.e: do I need to add the project2 method/module/celery app somewhere on project1 or is this behaviour not supported and each project would need a different Redis backend?

I fail to find where or how is the module name needed to send the tasks that are due. Some pointers would be greatly helpful!