Note that there are some explanatory texts on larger screens.

plurals
  1. POcelerybeat automatically disables periodic task
    text
    copied!<p>I'd like to create a periodic task for celery using <em>django-celery</em>'s admin interface. I have a task set up which runs great when called manually or by script. It just doesn't work through <em>celerybeat</em>. According to the debug logs the task is set to <code>enabled = False</code> on first retrieval and I wonder why.</p> <p>When adding the periodic task and passing <code>[1, False]</code> as positional arguments, the task is automatically disabled and I don't see any further output. When added without arguments the task is executed but raises an exception instantly because I didn't supply the needed arguments (makes sense).</p> <p>Does anyone see what's the problem here?</p> <p>Thanks in advance.</p> <p>This is the output after supplying arguments:</p> <pre><code>[DEBUG/Beat] SELECT "djcelery_periodictask"."id", [...] FROM "djcelery_periodictask" WHERE "djcelery_periodictask"."enabled" = true ; args=(True,) [DEBUG/Beat] SELECT "djcelery_intervalschedule"."id", [...] FROM "djcelery_intervalschedule" WHERE "djcelery_intervalschedule"."id" = 3 ; args=(3,) [DEBUG/Beat] SELECT (1) AS "a" FROM "djcelery_periodictask" WHERE "djcelery_periodictask"."id" = 3 LIMIT 1; args=(3,) [DEBUG/Beat] UPDATE "djcelery_periodictask" SET "name" = E'&lt;taskname&gt;', "task" = E'&lt;task.module.path&gt;', "interval_id" = 3, "crontab_id" = NULL, "args" = E'[1, False,]', "kwargs" = E'{}', "queue" = NULL, "exchange" = NULL, "routing_key" = NULL, "expires" = NULL, "enabled" = false, "last_run_at" = E'2011-05-25 00:45:23.242387', "total_run_count" = 9, "date_changed" = E'2011-05-25 09:28:06.201148' WHERE "djcelery_periodictask"."id" = 3; args=( u'&lt;periodic-task-name&gt;', u'&lt;task.module.path&gt;', 3, u'[1, False,]', u'{}', False, u'2011-05-25 00:45:23.242387', 9, u'2011-05-25 09:28:06.201148', 3 ) [DEBUG/Beat] Current schedule: &lt;ModelEntry: celery.backend_cleanup celery.backend_cleanup(*[], **{}) {&lt;crontab: 0 4 * (m/h/d)&gt;} [DEBUG/Beat] Celerybeat: Waking up in 5.00 seconds. </code></pre> <p><strong>EDIT:</strong> It works with the following setting. I still have no idea why it doesn't work with <em>django-celery</em>.</p> <pre><code>CELERYBEAT_SCHEDULE = { "example": { "task": "&lt;task.module.path&gt;", "schedule": crontab(), "args": (1, False) }, } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload