Socorro requires that certain upkeep jobs run periodically. For this, we have
cronrun Django command that runs Django commands at scheduled times.
Job configuration is in
Code is in
Run script is
/app/bin/run_crontabber.sh. This is an infinite loop that
manage.py cronrun command every 5 minutes.
cronrun can run any Django command at scheduled times. It supports several
Arguments: Any arguments can be passed to the command.
Backfill: If a command hasn’t run on schedule for some time, it will be run with all the time slots that it missed.
cronrunknows when the command last succeeded and can pass this in as an argument allowing the command to look at “all the things that happened since last I ran”.
Error reporting: Errors are sent to Sentry.
Logging: All stdout is send to the logger.
manage.py cronrun helper commands¶
All commands are accessed in a shell in the app container. For example:
$ make shell app@socorro:/app$ webapp/manage.py cronrun --help
Runs any scheduled jobs that need to be run.
Lists scheduled jobs and bookkeeping information.
Resets the state of specified jobs.
Marks specified jobs as successful.
cronrun is a Django management command, so it’s configured the same as
Running in a local dev environment¶
To run the processor in the local dev environment, do:
$ docker compose up crontabber
Running in a server environment¶
Use the same configuration as the webapp with a
Run the docker image using the
crontabber command. Something like this:
docker run \ --env-file=webapp.env \ mozilla/socorro_app crontabber