Skip to content

Instantly share code, notes, and snippets.

@jayd3e
Created July 9, 2012 21:22
Show Gist options
  • Save jayd3e/3079031 to your computer and use it in GitHub Desktop.
Save jayd3e/3079031 to your computer and use it in GitHub Desktop.
Question?
def update(p, attrs):
"""
Updates a specific "Job" dict, must be given an id
"""
k = keys()
job_dict = pop_job(default_queue_name, attrs['id'])
# sometimes the job_dict comes back as None, why?
if 'id' in attrs:
job_dict = pop_job(p, attrs['id'])
else:
raise Exception('Must pass an id into the update function.')
if job_dict:
for key, val in attrs.items():
job_dict[key] = val
p.sadd(k['jobs'], json.dumps(job_dict))
p.execute()
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment