2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: Apache-2.0
10 arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=True)
12 this_job = arvados.current_job()
13 this_task = arvados.current_task()
15 if 'algorithm' in this_job['script_parameters']:
16 alg = this_job['script_parameters']['algorithm']
19 digestor = hashlib.new(alg)
21 input_file = arvados.get_task_param_mount('input')
23 with open(input_file) as f:
30 hexdigest = digestor.hexdigest()
32 file_name = '/'.join(this_task['parameters']['input'].split('/')[1:])
34 out = arvados.CollectionWriter()
35 out.set_current_file_name("md5sum.txt")
36 out.write("%s %s\n" % (hexdigest, file_name))
37 this_task.set_output(out.finish())