Created
June 13, 2012 22:49
-
-
Save manveru/2927007 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from iron_worker import * | |
import zipfile | |
import shutil | |
import airbrakepy | |
import xmlbuilder | |
# here we have to include dependencies. | |
worker_dir = os.path.dirname(__file__) + '/airbrake' | |
# copy them to worker directory | |
shutil.copytree(os.path.dirname(airbrakepy.__file__), worker_dir + '/airbrakepy') | |
shutil.copytree(os.path.dirname(xmlbuilder.__file__), worker_dir + '/xmlbuilder') | |
zip = zipfile.ZipFile("worker.zip", "w") | |
for dirname, dirnames, filenames in os.walk("airbrake"): | |
root_dir = dirname.split("/", 1) | |
if len(root_dir) < 2: | |
root_dir = "/" | |
else: | |
root_dir = root_dir[1] | |
for filename in filenames: | |
zip.write(os.path.join(dirname, filename), os.path.join(root_dir, filename)) | |
zip.close() | |
# start the upload | |
worker = IronWorker(token='xxxx', project_id='xxxx') | |
res = worker.postCode(runFilename='worker.py', zipFilename='worker.zip', name='Airbrake.py sample') | |
task = worker.postTask(name='Airbrake.py sample') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment