X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/07d92519438a592d531f2c7558cd51788da262ca..4d56f9b913fcf41fbf89bf5016463b5353fa3a9f:/crunch_scripts/hash diff --git a/crunch_scripts/hash b/crunch_scripts/hash deleted file mode 100755 index 56eec7a5ff..0000000000 --- a/crunch_scripts/hash +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) The Arvados Authors. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 - -import arvados -import hashlib -import os - -arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=True) - -this_job = arvados.current_job() -this_task = arvados.current_task() - -if 'algorithm' in this_job['script_parameters']: - alg = this_job['script_parameters']['algorithm'] -else: - alg = 'md5' -digestor = hashlib.new(alg) - -input_file = arvados.get_task_param_mount('input') - -with open(input_file) as f: - while True: - buf = f.read(2**20) - if len(buf) == 0: - break - digestor.update(buf) - -hexdigest = digestor.hexdigest() - -file_name = '/'.join(this_task['parameters']['input'].split('/')[1:]) - -out = arvados.CollectionWriter() -out.set_current_file_name("md5sum.txt") -out.write("%s %s\n" % (hexdigest, file_name)) -this_task.set_output(out.finish())