X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/575443545936e6b8a1a4783e3d0e17d0246c6e99..a11c56ef66604a9117e3db8c2fa2273c98f88b51:/sdk/cli/bin/crunch-job diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job index 2415217a21..c312f5d169 100755 --- a/sdk/cli/bin/crunch-job +++ b/sdk/cli/bin/crunch-job @@ -1274,10 +1274,10 @@ sub fetch_block return $output_block; } -# create_output_collections generates a new collection containing the -# output of each successfully completed task, and returns the -# portable_data_hash for the new collection. -# +# Create a collection by concatenating the output of all tasks (each +# task's output is either a manifest fragment, a locator for a +# manifest fragment stored in Keep, or nothing at all). Return the +# portable_data_hash of the new collection. sub create_output_collection { Log (undef, "collate"); @@ -1292,10 +1292,11 @@ sub create_output_collection '.execute()["portable_data_hash"]' ); + my $task_idx = -1; for (@jobstep) { - next if (!exists $_->{'arvados_task'}->{'output'} || - !$_->{'arvados_task'}->{'success'}); + ++$task_idx; + next unless exists $_->{'arvados_task'}->{'output'}; my $output = $_->{'arvados_task'}->{output}; if ($output !~ /^[0-9a-f]{32}(\+\S+)*$/) { @@ -1307,7 +1308,8 @@ sub create_output_collection } else { - Log (undef, "XXX fetch_block($output) failed XXX"); + my $uuid = $_->{'arvados_task'}->{'uuid'}; + Log (undef, "Error retrieving '$output' output by task $task_idx ($uuid)"); $main::success = 0; } } @@ -1907,10 +1909,15 @@ if (readlink ("$destdir.commit") eq $commit && -d $destdir) { unlink "$destdir.commit"; mkdir $destdir; -open TARX, "|-", "tar", "-xC", $destdir; -{ - local $/ = undef; - print TARX ; + +if (!open(TARX, "|-", "tar", "-xC", $destdir)) { + die "Error launching 'tar -xC $destdir': $!"; +} +# If we send too much data to tar in one write (> 4-5 MiB), it stops, and we +# get SIGPIPE. We must feed it data incrementally. +my $tar_input; +while (read(DATA, $tar_input, 65536)) { + print TARX $tar_input; } if(!close(TARX)) { die "'tar -xC $destdir' exited $?: $!";