Created
January 20, 2015 16:22
-
-
Save amix/6784f4f71d9b3e8f8227 to your computer and use it in GitHub Desktop.
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
def add_job(self, job_type, job_id=None, on_duplicate='overwrite', | |
timestamp=None, distribute=None, **data): | |
""" | |
Add a new job to execute | |
:param job_type: string with the name of the job | |
:param job_id: job identifier, if not set, then a new random unique id | |
will be generated | |
:param on_duplicate: action on identifier duplicate, can be "overwrite" | |
or "discard" | |
:param timestamp: None, datetime object, timedelta, or number of seconds | |
in which the job has to be executed | |
:param distribute: distribute task among multiple handlers | |
the parameter should look like `(seed_id, num_of_workers)` | |
:param \*\*data: job data: kwargs for job handler function | |
:return: job id as a string or None, if the queue is eager | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment