5 arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True)
6 this_task = arvados.current_task()
8 # Get the input collection for this task
9 this_task_input = this_task['parameters']['input']
11 # Create a CollectionReader to access the collection
12 input_collection = arvados.CollectionReader(this_task_input)
14 # Get the name of the first file in the collection
15 input_file = list(input_collection.all_files())[0].name()
17 # Extract the file to a temporary directory
18 # Returns the directory that the file was written to
19 input_dir = arvados.util.collection_extract(this_task_input,
24 # Run the external 'md5sum' program on the input file, with the current working
25 # directory set to the location the input file was extracted to.
26 stdoutdata, stderrdata = arvados.util.run_command(
27 ['md5sum', input_file],
30 # Save the standard output (stdoutdata) "md5sum.txt" in the output collection
31 out = arvados.CollectionWriter()
32 out.set_current_file_name("md5sum.txt")
35 this_task.set_output(out.finish())