Created
March 5, 2013 23:04
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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