X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e4f96fc61cd9c85f91bdb0020bc365f2f4825ffb..7b6a085a92e78787a15a34ad8e536444ad230552:/doc/_includes/_run_md5sum_py.liquid diff --git a/doc/_includes/_run_md5sum_py.liquid b/doc/_includes/_run_md5sum_py.liquid index 16516a8852..6d10672db6 100644 --- a/doc/_includes/_run_md5sum_py.liquid +++ b/doc/_includes/_run_md5sum_py.liquid @@ -1,9 +1,15 @@ #!/usr/bin/env python +{% comment %} +Copyright (C) The Arvados Authors. All rights reserved. + +SPDX-License-Identifier: CC-BY-SA-3.0 +{% endcomment %} import arvados # Automatically parallelize this job by running one task per file. -arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=True) +arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, + input_as_path=True) # Get the input file for the task input_file = arvados.get_task_param_mount('input') @@ -13,6 +19,6 @@ stdoutdata, stderrdata = arvados.util.run_command(['md5sum', input_file]) # Save the standard output (stdoutdata) to "md5sum.txt" in the output collection out = arvados.CollectionWriter() -out.set_current_file_name("md5sum.txt") -out.write(stdoutdata) +with out.open('md5sum.txt') as out_file: + out_file.write(stdoutdata) arvados.current_task().set_output(out.finish())