Skip to content

Instantly share code, notes, and snippets.

@amix
Created January 20, 2015 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amix/6784f4f71d9b3e8f8227 to your computer and use it in GitHub Desktop.
Save amix/6784f4f71d9b3e8f8227 to your computer and use it in GitHub Desktop.
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