Skip to content

Instantly share code, notes, and snippets.

@shibz
Created March 5, 2013 23:04
Show Gist options
  • Save shibz/5095177 to your computer and use it in GitHub Desktop.
Save shibz/5095177 to your computer and use it in GitHub Desktop.
Custom command for django-cronograph. Quick and dirty fix for multithreading issues. Just drop into chronograph/management/commands
from django.core.management.base import BaseCommand
import logging
import os
import sys
import time
logger = logging.getLogger('chronograph.commands.cron_serial')
class Command(BaseCommand):
help = 'Runs all jobs that are due. Run them one at a time rather than forking into multiple threads.'
def handle(self, *args, **options):
from chronograph.models import Job
procs = []
for job in Job.objects.due():
if not job.check_is_running():
logger.info("Running Job: '%s'" % job)
job.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment