From c59670ea1fd789bf084b83fb33be3b84312dc07b Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 28 Aug 2014 11:20:35 -0400 Subject: [PATCH] 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. --- sdk/cli/bin/crunch-job | 5 +++-- sdk/python/arvados/commands/put.py | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job index 9e7454f47a..3803df48ca 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 7b6b048b1d..6abaf77087 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'] -- 2.30.2