[ARVADOS] updated: d4346ebd1ef1158a73d9adfa757cfce0713abb1d
git at public.curoverse.com
git at public.curoverse.com
Fri Feb 21 11:33:34 EST 2014
Summary of changes:
crunch_scripts/hash | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
via d4346ebd1ef1158a73d9adfa757cfce0713abb1d (commit)
from 7769d5742b41712bc411d75d6cd6b536cd87a3e4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit d4346ebd1ef1158a73d9adfa757cfce0713abb1d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Feb 21 11:34:44 2014 -0500
Hash now uses get_task_param_mount() to read from fuse mount instead of CollectionReader.
diff --git a/crunch_scripts/hash b/crunch_scripts/hash
index 3c15716..cdd5eba 100755
--- a/crunch_scripts/hash
+++ b/crunch_scripts/hash
@@ -1,13 +1,13 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
import arvados
import hashlib
+import os
-arvados.job_setup.one_task_per_input_file(if_sequence=0, and_end_task=True)
+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()
-this_task_input = this_task['parameters']['input']
if 'algorithm' in this_job['script_parameters']:
alg = this_job['script_parameters']['algorithm']
@@ -15,18 +15,18 @@ else:
alg = 'md5'
digestor = hashlib.new(alg)
-input_file = list(arvados.CollectionReader(this_task_input).all_files())[0]
-while True:
- buf = input_file.read(2**20)
- if len(buf) == 0:
- break
- digestor.update(buf)
+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 = input_file.name()
-if input_file.stream_name() != '.':
- file_name = os.join(input_file.stream_name(), file_name)
+file_name = '/'.join(this_task['parameters']['input'].split('/')[1:])
out = arvados.CollectionWriter()
out.set_current_file_name("md5sum.txt")
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list