HTTP 400 errors when using run_every in IronWorker Python

Filed in: Python

Say you have a small script like the following:

import sys
from iron_worker import IronWorker
from iron_worker import Task

worker = IronWorker()
task = Task(
    code_name="HelloWorld", 
    scheduled=True, 
    run_every=sys.argv[1])

response = worker.queue(task)
print response

If you want to schedule the job to run every minute you could call python schedule.py 60. This will unfortunately return an HTTP 400 response.

The reason is that the run_every parameter is being passed as a string. A simple fix is to convert to an int:

task = Task(
    ...
    run_every=int(sys.argv[1]))

Django Code of Conduct

Filed in: Conferences, Django, Python

In light of recent events at PyCon, there has been plenty of discussion about inappropriate conduct. Due to the numerous tangents this discussion has taken, I think it’s important to contemplate why PyCon has a code of conduct.

The first draft of Django’s Code of Conduct hits the nail on the head for me:

Maintaining a code of conduct forces us to consider and articulate what kind of community we want to be, and serves as a constant reminder to put our best foot forward. But most importantly, it serves as a signpost to people looking to join our community that we feel these values are important.