[ARVADOS] created: c59670ea1fd789bf084b83fb33be3b84312dc07b

git at public.curoverse.com git at public.curoverse.com
Thu Aug 28 11:20:54 EDT 2014


        at  c59670ea1fd789bf084b83fb33be3b84312dc07b (commit)


commit c59670ea1fd789bf084b83fb33be3b84312dc07b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Aug 28 11:20:35 2014 -0400

    3709: arv-put now prints collection uuid by default.  Add --portable-data-hash
    to arv-put to get the old behavior (print PDH).  Crunch-job uses arv-put
    --portable-data-hash to get the PDH to put in the log field.  Crunch-job logs
    both PDH and collection UUID.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index 9e7454f..3803df4 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -860,7 +860,8 @@ else {
     my $output = $arv->{'collections'}->{'create'}->execute('collection' => {
       'manifest_text' => $orig_manifest_text,
     });
-    Log(undef, "output " . $output->{portable_data_hash});
+    Log(undef, "output uuid " . $output->{uuid});
+    Log(undef, "output hash " . $output->{portable_data_hash});
     $Job->update_attributes('output' => $output->{portable_data_hash}) if $job_has_uuid;
   };
   if ($@) {
@@ -1335,7 +1336,7 @@ sub save_meta
   return if $justcheckpoint;  # checkpointing is not relevant post-Warehouse.pm
 
   $local_logfile->flush;
-  my $cmd = "arv-put --filename ''\Q$keep_logfile\E "
+  my $cmd = "arv-put --portable-data-hash --filename ''\Q$keep_logfile\E "
       . quotemeta($local_logfile->filename);
   my $loglocator = `$cmd`;
   die "system $cmd failed: $?" if $?;
diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index 7b6b048..6abaf77 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -106,6 +106,12 @@ input file. It can be used only if there is exactly one path given and
 it is not a directory. Implies --manifest.
 """)
 
+upload_opts.add_argument('--portable-data-hash', action='store_true',
+                    help="""
+Print the portable data hash instead of the Arvados UUID for the collection
+created by the upload.
+""")
+
 run_opts = argparse.ArgumentParser(add_help=False)
 _group = run_opts.add_mutually_exclusive_group()
 _group.add_argument('--progress', action='store_true',
@@ -457,7 +463,7 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
                 },
             ).execute()
 
-        if 'portable_data_hash' in collection and collection['portable_data_hash']:
+        if args.portable_data_hash and 'portable_data_hash' in collection and collection['portable_data_hash']:
             output = collection['portable_data_hash']
         else:
             output = collection['uuid']

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list