abelardopardo / abelardopardo/ontask_b

Scheduled actions are not registering in celery

Aperta
#266 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Bug
Lingua principale
Python
Stelle
45
Fork
32
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**
Scheduling actions are executed by the task `execute_scheduled_operation` which is not registered as a task in the celery workers. Tested with `Version_11_1`.

**To Reproduce**
Steps to reproduce the behavior:
1. Import the sample workflow
2. Schedule an action for 5 (or less) minutes in the future
3. Wait for the 5 mins to pass
4. Check the celery worker logs, you'll get:
```
[tasks]
. ontask.celery.debug_task
. ontask.tasks.execute.execute_operation

2024-05-22 16:50:57,592 WARNING 1 [py.warnings] warnings.py:109 - /app/venv/lib/python3.9/site-packages/celery/worker/consumer/consumer.py:507: CPendingDeprecationWarning: The broker_connection_retry configuration setting will no longer determine
whether broker connection retries are made during startup in Celery 6.0 and above.
If you wish to retain the existing behavior for retrying connections on startup,
you should set broker_connection_retry_on_startup to True.
warnings.warn(

2024-05-22 16:50:57,601 INFO 1 [celery.worker.consumer.connection] connection.py:22 - Connected to redis://redis:6379//
2024-05-22 16:50:57,601 WARNING 1 [py.warnings] warnings.py:109 - /app/venv/lib/python3.9/site-packages/celery/worker/consumer/consumer.py:507: CPendingDeprecationWarning: The broker_connection_retry configuration setting will no longer determine
whether broker connection retries are made during startup in Celery 6.0 and above.
If you wish to retain the existing behavior for retrying connections on startup,
you should set broker_connection_retry_on_startup to True.
warnings.warn(

2024-05-22 16:50:57,605 INFO 1 [celery.worker.consumer.mingle] mingle.py:40 - mingle: searching for neighbors
2024-05-22 16:50:58,628 INFO 1 [celery.worker.consumer.mingle] mingle.py:43 - mingle: sync with 2 nodes
2024-05-22 16:50:58,628 INFO 1 [celery.worker.consumer.mingle] mingle.py:47 - mingle: sync complete
2024-05-22 16:50:58,644 INFO 1 [celery.apps.worker] worker.py:175 - celery@ontask.default.%ontask-worker-74f5fb6cbc-nx4ch ready.
2024-05-22 17:00:00,031 ERROR 1 [celery.worker.consumer.consumer] consumer.py:587 - Received unregistered task of type 'ontask.tasks.scheduled_ops.execute_scheduled_operation'.
The message has been ignored and discarded.

Did you remember to import the module containing this task?
Or maybe you're using relative imports?

Please see
https://docs.celeryq.dev/en/latest/internals/protocol.html
for more information.

The full contents of the message body was:
b'[[2], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]' (78b)

The full contents of the message headers:
{'lang': 'py', 'task': 'ontask.tasks.scheduled_ops.execute_scheduled_operation', 'id': '941c7221-75f7-4ff7-9b70-5ee182ca97d8', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': '941c7221-75f7-4ff7-9b70-5ee182ca97d8', 'parent_id': None, 'argsrepr': '[2]', 'kwargsrepr': '{}', 'origin': 'gen1@ontask-celery-beat-55d87fd86f-shbcl', 'ignore_result': False, 'replaced_task_nesting': 0, 'stamped_headers': None, 'stamps': {}}

The delivery info for this task is:
{'exchange': '', 'routing_key': 'celery'}
Traceback (most recent call last):
File "/app/venv/lib/python3.9/site-packages/celery/worker/consumer/consumer.py", line 658, in on_task_received
strategy = strategies[type_]
KeyError: 'ontask.tasks.scheduled_ops.execute_scheduled_operation'

```
**Expected behavior**
Scheduled actions should be executed by the celery worker.

**Additional context**
OnTask is hosted in a EKS cluster with a celery - celery beat - redis setup.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.