diff options
author | Tom Ritter <tom@ritter.vg> | 2016-01-31 13:22:08 -0600 |
---|---|---|
committer | Tom Ritter <tom@ritter.vg> | 2016-01-31 13:22:08 -0600 |
commit | 3bea3bae59e7404b286b5bf97a6270270bfadd6c (patch) | |
tree | c9d1d7cf76681420587198d09abda761912c47c4 /README.md | |
parent | 1a8b46d940d3a4bc06700d15307191bb10008ea6 (diff) |
Refactor lots of things to allow you to be notified every so often, instead of every single time.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -29,21 +29,22 @@ This wouldn't be any good if you couldn't specify your own custom jobs. There ar ### Inherit JobBase -JobBase is the base for a job, and should be used when you have a single, custom job you want to run. Your job needs to match the name of the file it is in. You should override two functions: +JobBase is the base for a job, and should be used when you have a single, custom job you want to run. Your job needs to match the name of the file it is in. You should override three (or four) functions: * executeEvery * This should return a JobFrequency constant indicating how often you want the job to run +* notifyOnFailureEvery + * This should return a JobFailureNotificationFrequency constant indicating how often you want to be notified about a (continually) failing job * execute - * This does the work - * It should _not_ return False if it fails, instead it should return False _only if it cannot send email_. If this function returns false, checker assumes it cannot send mail. - -An appropriate way to end the function would be: - - if not success: - return self.sendEmail("Failed executing bob-job", failureMessage) - else: - return True - + * This does the work. It returns True if the job succeeded or False if it didn't +* onFailure + * This is called if the job failed _and_ the admin should be notified. You should return if the email could be sent or not. + * E.G. return self.sendEmail("Job Failed", self.details_of_error) +* onStateChangeSuccess + * This is called if a) you specified JobFailureNotificationFrequency.ONSTATECHANGE in notifyOnFailureEvery + * A job was previously failing but just suceeded + * Like onFailure, it should return if the email could be sent or not. + * E.G. return self.sendEmail("Job Suceeded", "") ### Inherit JobSpawner |