Merge branch 'master' into 2257-inequality-conditions
[arvados.git] / doc / _includes / _run_md5sum_py.liquid
1 #!/usr/bin/env python
2
3 import arvados
4
5 # Automatically parallelize this job by running one task per file.
6 arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=True)
7
8 # Get the input file for the task
9 input_file = arvados.get_task_param_mount('input')
10
11 # Run the external 'md5sum' program on the input file
12 stdoutdata, stderrdata = arvados.util.run_command(['md5sum', input_file])
13
14 # Save the standard output (stdoutdata) to "md5sum.txt" in the output collection
15 out = arvados.CollectionWriter()
16 out.set_current_file_name("md5sum.txt")
17 out.write(stdoutdata)
18 arvados.current_task().set_output(out.finish())