Chaining together tasks with jobs

import qarnot

# Connect to Qarnot
conn = qarnot.connection.Connection(client_token="<<<MY_SECRET_TOKEN>>>")

# Create and submit a job
job = conn.create_job('Hello World - job', useDependencies=True)

# Create a write task associated to the job
# This task will write Hello World in a .txt file
write_task = conn.create_task('Hello World - Write', 'docker-batch', 1, job=job)
write_task.constants['DOCKER_CMD'] = 'sh -c "echo Hello World ! > output.txt"'

# Create an output bucket for the write task
write_task_output = conn.create_bucket('write-output')
write_task.results = write_task_output

# Create a read task associated to the job
# This task will read the contents of output.txt and print it
read_task = conn.create_task('Hello World - Read', 'docker-batch', 1, job=job)
read_task.constants['DOCKER_CMD'] = 'cat output.txt'

# Use the write task's output bucket as an input

# Submit the write task 

# Submit the read task as being dependant of the write task

Any feedback on this page ?

© Qarnot Computing