# HG changeset patch # User Lennard de Rijk # Date 1240067064 0 # Node ID 2c6ec0357149efa594c102a869ff7a5551cbaec7 # Parent 2ac430aa57995b43977849b567ca4670b78aa70e Added FatalJobError to the cron/job module. This Error will lead to abortion of the raising job. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed diff -r 2ac430aa5799 -r 2c6ec0357149 app/soc/cron/job.py --- a/app/soc/cron/job.py Sat Apr 18 14:51:27 2009 +0000 +++ b/app/soc/cron/job.py Sat Apr 18 15:04:24 2009 +0000 @@ -30,6 +30,18 @@ from soc.models.job import Job +class Error(Exception): + """Base class for all exceptions raised by this module. + """ + pass + + +class FatalJobError(Error): + """Class for all errors that lead to immediate job abortion. + """ + pass + + class Handler(object): """A handler that dispatches a cron job. @@ -136,6 +148,10 @@ except DeadlineExceededError, exception: db.run_in_transaction(self.freeJob, job_key) return False + except FatalJobError, exception: + logging.exception(exception) + db.run_in_transaction(self.abortJob, job_key) + return True except Exception, exception: logging.exception(exception) db.run_in_transaction(self.failJob, job_key)