Configuring tasks to run repeatedly on a schedule
Tasks are scheduled in the Django admin panel under Django Q and Scheduled Tasks. Add a new task, give the task a name, and tell it which function to run. Functions must be prefixed with
tasks.to tell Django Q to pull the functions from
tasks.py. The final requirement is a schedule. Tasks can be run once or repeatedly (e.g. minutes, hourly, daily, weekly).
You can provide arguments for the functions as needed. Ghostwriter's scheduled tasks do not require arguments, but some have optional arguments. For example, the
scan_servers()function accepts an
active_onlyargument to restrict scanning only to servers that have been checked out for a project.
Visit the Django Q database from the admin panel to access the Scheduled Tasks. You may wish to create a scheduled task to automatically release domains at the end of a project. There is a task for this already in
This example executes
ghostwriter.shepherd.tasks.release_domainsunder the name
Domain Releaseevery day at 15:39 UTC with no additional args or kwargs.
Scheduling release_domains() with Django Q