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

Failure to register jobs at startup #34

Open
nrobinsonwall-dare opened this issue May 20, 2024 · 1 comment
Open

Failure to register jobs at startup #34

nrobinsonwall-dare opened this issue May 20, 2024 · 1 comment

Comments

@nrobinsonwall-dare
Copy link

Hello! I'm having the following issue where cronitor-python is attempting to inject headers into tasks on startup, but it's failing to look up tasks in the registry:

Starting ...
Booting API server
Settings module: redacted
Log level: INFO
Debug: False
celery beat v5.3.6 (emerald-rush) is starting.
__    -    ... __   -        _
LocalTime -> 2024-05-17 16:38:54
Configuration ->
    . broker -> redacted
    . loader -> celery.loaders.app.AppLoader
    . scheduler -> django_celery_beat.schedulers.DatabaseScheduler
    . logfile -> [stderr]@%INFO
    . maxinterval -> 5.00 seconds (5s)
[2024-05-17 16:38:54,186: INFO/MainProcess] beat: Starting...
[2024-05-17 16:38:54,808: INFO/MainProcess] DatabaseScheduler: Schedule changed.
[2024-05-17 16:38:54,815: ERROR/MainProcess] Signal handler <function celerybeat_startup at 0x7efdb990cf40> raised: AttributeError("'NoneType' object has no attribute 's'")
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/celery/utils/dispatch/signal.py", line 276, in send
    response = receiver(signal=self, sender=sender, **named)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cronitor/celery.py", line 113, in celerybeat_startup
    app.tasks.get(entry.task).s().set(headers=headers),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 's'
[2024-05-17 16:38:55,125: INFO/MainProcess] DatabaseScheduler: Schedule changed.

This is causing it not to register schedules for tasks on celery startup (though actual task executions are being captured)

@aflanagan
Copy link
Collaborator

Hi Nick,

Thanks for opening this. I believe the cause of this is that you're trying to run the discover command while using the django_celery_beat scheduler, which unfortunately is not supported.

It should, at a minimum, raise a better error message, however I'd love to support this better for other Djang/Celery devs. We would welcome a pull request!

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