4410: crunch-dispatch logs crunch-job exit later.
authorBrett Smith <brett@curoverse.com>
Mon, 15 Jun 2015 21:04:25 +0000 (17:04 -0400)
committerBrett Smith <brett@curoverse.com>
Mon, 22 Jun 2015 20:49:52 +0000 (16:49 -0400)
This makes it easier to log the exit code, and makes the logs look
nicer because the exit log doesn't interrupt crunch-job's stderr.

services/api/script/crunch-dispatch.rb

index 1002f9134736ab84136f2f8b9032ff630e14ce84..3c1e4c60cd4bba2185f91c9025d61fddeb31dbf0 100755 (executable)
@@ -634,8 +634,6 @@ class Dispatcher
     return if !pid_done
 
     job_done = j_done[:job]
-    $stderr.puts "dispatch: child #{pid_done} exit"
-    $stderr.puts "dispatch: job #{job_done.uuid} end"
 
     # Ensure every last drop of stdout and stderr is consumed.
     read_pipes
@@ -653,6 +651,9 @@ class Dispatcher
     # Wait the thread (returns a Process::Status)
     exit_status = j_done[:wait_thr].value.exitstatus
 
+    $stderr.puts "dispatch: child #{pid_done} exit #{exit_status}"
+    $stderr.puts "dispatch: job #{job_done.uuid} end"
+
     jobrecord = Job.find_by_uuid(job_done.uuid)
     if exit_status != EXIT_TEMPFAIL and jobrecord.state == "Running"
       # crunch-job did not return exit code 75 (see below) and left the job in