3 # Import the Arvados sdk module
6 # Get information about the task from the environment
7 this_task = arvados.current_task()
9 this_task_input = arvados.current_job()['script_parameters']['input']
11 # Create the object access to the collection referred to in the input
12 collection = arvados.CollectionReader(this_task_input)
14 # Create an object to write a new collection as output
15 out = arvados.CollectionWriter()
17 # Set the name of output file within the collection
18 out.set_current_file_name("0-filter.txt")
20 # Get an iterator over the files listed in the collection
21 all_files = collection.all_files()
23 # Iterate over each file
24 for input_file in all_files:
25 for ln in input_file.readlines():
29 # Commit the output to keep. This returns a Keep id.
30 output_id = out.finish()
32 # Set the output for this task to the Keep id
33 this_task.set_output(output_id)