Skip to content

Instantly share code, notes, and snippets.

@iwein
Created May 7, 2012 17:28
Show Gist options
  • Save iwein/2629126 to your computer and use it in GitHub Desktop.
Save iwein/2629126 to your computer and use it in GitHub Desktop.
Iron.io scheduler
from iron_worker import *
//you could read this from a file or stdin if you're not too lazy
payload = {'herokuping':{'hosts': ['comma-separated-hosts.com', 'another.net']}}
worker = IronWorker(config='config.ini')
name = "heroku-pinger"
zipFile = IronWorker.createZip(files=["herokuping_worker.py"],
destination="herokuping_worker.zip", overwrite=True)
ret = worker.postCode(name=name, runFilename="herokuping_worker.py",
zipFilename="herokuping_worker.zip")
print str(ret)
ret = worker.postSchedule(name=name,
delay=10, run_every=900, run_times=300000,
payload=payload)
print "postTask returned: %s" % ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment