Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when using django-celery-beat in two projects sharing the same database #579

Open
Kinzowa opened this issue Sep 9, 2022 · 1 comment

Comments

@Kinzowa
Copy link

Kinzowa commented Sep 9, 2022

Hello,

I have two Django projects that share the same database, and both project have django-celery-beat installed. The problem I have with this configuration is that periodic tasks from one project are detected by the other project as unregistered and REJECTED. They do not appear in the Periodic tasks admin section of the other project because they are unregistered but log show there is an issue.

I believe the reason is that the two django-celery-beat applications share the same tables of the shared database.

Could you tell me what is the best solution to address the issue ? Do you think I could change the name of the application so that 2 django-celery-beat live separatly in the database ?

Thank you

project-a-celery_worker-1  | 2022-09-09T11:35:15.974463294Z Received unregistered task of type 'trading.tasks.bulk_trade'.
project-a-celery_worker-1  | 2022-09-09T11:35:15.974621504Z The message has been ignored and discarded.
project-a-celery_worker-1  | 2022-09-09T11:35:15.974655749Z 
project-a-celery_worker-1  | 2022-09-09T11:35:15.974677303Z Did you remember to import the module containing this task?
project-a-celery_worker-1  | 2022-09-09T11:35:15.974699464Z Or maybe you're using relative imports?
project-a-celery_worker-1  | 2022-09-09T11:35:15.974721029Z 
project-a-celery_worker-1  | 2022-09-09T11:35:15.974741804Z Please see
project-a-celery_worker-1  | 2022-09-09T11:35:15.974782954Z http://docs.celeryq.org/en/latest/internals/protocol.html
project-a-celery_worker-1  | 2022-09-09T11:35:15.974815238Z for more information.
project-a-celery_worker-1  | 2022-09-09T11:35:15.974839132Z 
project-a-celery_worker-1  | 2022-09-09T11:35:15.974897495Z The full contents of the message body was:
project-a-celery_worker-1  | 2022-09-09T11:35:15.974938229Z b'[[], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]' (77b)
project-a-celery_worker-1  | 2022-09-09T11:35:15.974982482Z 
project-a-celery_worker-1  | 2022-09-09T11:35:15.975032349Z Thw full contents of the message headers:
project-a-celery_worker-1  | 2022-09-09T11:35:15.975090058Z {'lang': 'py', 'task': 'trading.tasks.bulk_trade', 'id': 'd86620c2-04ab-4b59-bb2e-77685389f8d5', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': 'd86620c2-04ab-4b59-bb2e-77685389f8d5', 'parent_id': None, 'argsrepr': '()', 'kwargsrepr': '{}', 'origin': 'gen9@03298c28290e', 'ignore_result': False}
project-a-celery_worker-1  | 2022-09-09T11:35:15.975125751Z 
project-a-celery_worker-1  | 2022-09-09T11:35:15.975194550Z The delivery info for this task is:
project-a-celery_worker-1  | 2022-09-09T11:35:15.975257110Z {'exchange': '', 'routing_key': 'project-a_queue_1'}
project-a-celery_worker-1  | 2022-09-09T11:35:15.981241271Z  exc_info=(<class 'KeyError'>, KeyError('trading.tasks.bulk_trade'), <traceback object at 0x7fe49ca1b8c0>)
project-a-celery_worker-1  | 2022-09-09T11:35:15.996976839Z [error    ] task_not_found                              [django_structlog.celery.receivers] message=<Message object at 0x7fe49cb6e680 with details {'state': 'REJECTED', 'content_type': 'application/json', 'delivery_tag': '43925569-3d7a-4272-9629-2e08581f6579', 'body_length': 77, 'properties': {'correlation_id': 'd86620c2-04ab-4b59-bb2e-77685389f8d5'}, 'delivery_info': {'exchange': '', 'routing_key': 'project-a_queue_1'}}>
@auvipy
Copy link
Member

auvipy commented Oct 13, 2022

can you check this #451 PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants