9 Copyright (C) The Arvados Authors. All rights reserved.
11 SPDX-License-Identifier: CC-BY-SA-3.0
14 p=. *Legacy. The job APIs are read-only and disabled by default in new installations. Use "container requests":methods/container_requests.html .*
18 A crunch script is responsible for completing a single JobTask. In doing so, it will:
20 * (optionally) read some input from Keep
21 * (optionally) store some output in Keep
22 * (optionally) create some new JobTasks and add them to the current Job
23 * (optionally) update the current JobTask record with the "output" attribute set to a Keep locator or a fragment of a manifest
24 * update the current JobTask record with the "success" attribute set to True
26 A task's context is provided in environment variables.
28 table(table table-bordered table-condensed).
29 |Environment variable|Description|
30 |@JOB_UUID@|UUID of the current "Job":methods/jobs.html|
31 |@TASK_UUID@|UUID of the current "JobTask":methods/job_tasks.html|
32 |@ARVADOS_API_HOST@|Hostname and port number of API server|
33 |@ARVADOS_API_TOKEN@|Authentication token to use with API calls made by the current task|
35 The crunch script typically uses the Python SDK (or another suitable client library / SDK) to connect to the Arvados service and retrieve the rest of the details about the current job and task.
37 The Python SDK has some shortcuts for common operations.
39 In general, a crunch script can access information about the current job and task like this:
45 job = arvados.api().jobs().get(uuid=os.environ['JOB_UUID']).execute()
46 $sys.stderr.write("script_parameters['foo'] == %s"
47 % job['script_parameters']['foo'])
49 task = arvados.api().job_tasks().get(uuid=os.environ['TASK_UUID']).execute()
50 $sys.stderr.write("current task sequence number is %d"