5283: Log more crunch-job output handling.
[arvados.git] / sdk / cli / bin / crunch-job
index 068da88144254a2f4a55fccd72c8dc87498d0d80..9fb14b10d3c20e0f6e35e8c4903d2d69d55f4cc0 100755 (executable)
@@ -941,7 +941,7 @@ if (!$collated_output) {
   Log (undef, "Failed to write output collection");
 }
 else {
-  Log(undef, "output hash " . $collated_output);
+  Log(undef, "job output $collated_output");
   $Job->update_attributes('output' => $collated_output);
 }
 
@@ -1037,7 +1037,6 @@ sub reapchildren
     if (!$temporary_fail || $Jobstep->{'failures'} >= 3) {
       # Give up on this task, and the whole job
       $main::success = 0;
-      $main::please_freeze = 1;
     }
     # Put this task back on the todo queue
     push @jobstep_todo, $jobstepid;
@@ -1056,7 +1055,9 @@ sub reapchildren
   $Jobstep->{'arvados_task'}->{finished_at} = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime($Jobstep->{finishtime});
   $Jobstep->{'arvados_task'}->save;
   process_stderr ($jobstepid, $task_success);
-  Log ($jobstepid, "output " . $Jobstep->{'arvados_task'}->{output});
+  Log ($jobstepid, sprintf("task output (%d bytes): %s",
+                           length($Jobstep->{'arvados_task'}->{output}),
+                           $Jobstep->{'arvados_task'}->{output}));
 
   close $reader{$jobstepid};
   delete $reader{$jobstepid};
@@ -1299,6 +1300,7 @@ print (arvados.api("v1").collections().
 }, retry_count());
 
   my $task_idx = -1;
+  my $manifest_size = 0;
   for (@jobstep)
   {
     ++$task_idx;
@@ -1315,6 +1317,8 @@ print (arvados.api("v1").collections().
         # There's been an error writing.  Stop the loop.
         # We'll log details about the exit code later.
         last;
+      } else {
+        $manifest_size += length($next_write);
       }
     } else {
       my $uuid = $_->{'arvados_task'}->{'uuid'};
@@ -1323,11 +1327,12 @@ print (arvados.api("v1").collections().
     }
   }
   close($child_in);
+  Log(undef, "collated output manifest text to send to API server is $manifest_size bytes with access tokens");
 
   my $joboutput;
   my $s = IO::Select->new($child_out);
   if ($s->can_read(120)) {
-    sysread($child_out, $joboutput, 64 * 1024 * 1024);
+    sysread($child_out, $joboutput, 1024 * 1024);
     waitpid($pid, 0);
     if ($?) {
       Log(undef, "output collection creation exited " . exit_status_s($?));