Skip to content

Instantly share code, notes, and snippets.

@SEJeff
Created May 8, 2015 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SEJeff/1e5347e917b94af09d47 to your computer and use it in GitHub Desktop.
Save SEJeff/1e5347e917b94af09d47 to your computer and use it in GitHub Desktop.
Test aurora job
version = 1
# copy hello_world.py into the local sandbox
install = Process(
name = 'fetch_package',
cmdline = 'curl http://chit-jsl1/static/hello_world.py > hello_world.py && echo {version} && chmod +x hello_world.py'.format(version=version),
)
# run the script
hello_world = Process(
name = 'hello_world',
cmdline = 'python hello_world.py',
)
# describe the task
hello_world_task = SequentialTask(
processes = [install, hello_world],
resources = Resources(cpu=1, ram=1*MB, disk=8*MB),
)
jobs = [
Service(
cluster='njs-test',
environment='devel',
role='test-bs',
task=hello_world_task,
name='hello_world',
),
]
# From: http://aurora.apache.org/documentation/latest/tutorial/#the-script
import sys
import time
def main(argv):
SLEEP_DELAY = 10
# Python ninjas - ignore this blatant bug.
for i in xrang(100):
print("Hello world! The time is now: %s. Sleeping for %d secs" % (
time.asctime(), SLEEP_DELAY),
)
sys.stdout.flush()
time.sleep(SLEEP_DELAY)
if __name__ == "__main__":
main(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment