Skip to content

Instantly share code, notes, and snippets.

@RexGibson
Last active December 28, 2015 08:29
Show Gist options
  • Save RexGibson/7471795 to your computer and use it in GitHub Desktop.
Save RexGibson/7471795 to your computer and use it in GitHub Desktop.
Azkaban Python Project File Example
# remove this comment and save file in ~/.azkabanrc
[DEFAULT]
user =
session_id =
[vagrant]
url = https://localhost:8443
user = azkaban
session_id = 3b25ac47-a791-4648-8434-bcbc737e4ba5
from azkaban import Job, Project
project = Project('foo')
project.add_job('bar', Job({'type': 'command', 'command': 'echo "Hello!"'} ,{'type': 'command', 'command1': 'echo "test!"'}))
#project.add_job('biff', Job({'type': 'command', 'command': 'echo "Bang!"'}))
project.add_file('/usr/local/proj/tools/RedshiftETL/bin/experimental/bax.jar')
project.add_job('job3',Job({'type': 'command', 'command': 'echof "Job3 output"'},{'dependencies': 'bar'}))
project.add_job('job4',Job({'type': 'command', 'command': 'echo "Job4"'},{'dependencies': 'bar'}))
project.add_job('job5',Job({'type': 'command', 'command': 'echo "Job5"'},{'dependencies': 'job3,job4'}))
if __name__ == '__main__':
project.main()
# from the dir that askaban_test_project.py is located
python askaban_test_project.py upload -a vagrant
# test if project builds before upload
python askaban_test_project.py build
# test if project builds before upload
python askaban_test_project.py list
# from the python helper quick start
# Once we've saved our jobs file, the following commands are available to us:
#
# * :code:`python jobs.py list`, see the list of all jobs in the current project.
# * :code:`python jobs.py view`, view the contents of the :code:`.job` file for a given job.
# * :code:`python jobs.py build`, build the project archive and store it locally.
# * :code:`python jobs.py upload`, build and upload the project to an Azkaban server.
# quick start at https://pypi.python.org/pypi/azkaban/0.1.7
pip install azkaban
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment