[ARVADOS] updated: d79ca2ad99aceb528b1033a73035e6961aa25ba7

git at public.curoverse.com git at public.curoverse.com
Fri Sep 26 13:53:24 EDT 2014


Summary of changes:
 sdk/cli/bin/crunch-job | 60 +++++++++++++-------------------------------------
 1 file changed, 15 insertions(+), 45 deletions(-)

       via  d79ca2ad99aceb528b1033a73035e6961aa25ba7 (commit)
      from  73e06d599452789b1a1df1a8f9379e4c929b833b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d79ca2ad99aceb528b1033a73035e6961aa25ba7
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Sep 26 13:53:06 2014 -0400

    3859: Move job locking up earlier in crunch-job.  Don't try to lock the job
    when running locally.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index fffa9d1..2a4675b 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -153,30 +153,15 @@ if ($job_has_uuid)
 {
   $Job = $arv->{'jobs'}->{'get'}->execute('uuid' => $jobspec);
   if (!$force_unlock) {
-    # If some other crunch-job process has grabbed this job (or we see
-    # other evidence that the job is already underway) we exit
-    # EX_TEMPFAIL so crunch-dispatch (our parent process) doesn't
-    # mark the job as failed.
-    if ($Job->{'is_locked_by_uuid'}) {
-      Log(undef, "Job is locked by " . $Job->{'is_locked_by_uuid'});
-      exit EX_TEMPFAIL;
-    }
-    if ($Job->{'state'} ne 'Queued') {
-      Log(undef, "Job state is " . $Job->{'state'} . ", but I can only start queued jobs.");
-      exit EX_TEMPFAIL;
-    }
-    if ($Job->{'success'} ne undef) {
-      Log(undef, "Job 'success' flag (" . $Job->{'success'} . ") is not null");
-      exit EX_TEMPFAIL;
-    }
-    if ($Job->{'running'}) {
-      Log(undef, "Job 'running' flag is already set");
-      exit EX_TEMPFAIL;
-    }
-    if ($Job->{'started_at'}) {
-      Log(undef, "Job 'started_at' time is already set (" . $Job->{'started_at'} . ")");
-      exit EX_TEMPFAIL;
-    }
+    # Claim this job, and make sure nobody else does
+    eval {
+      # lock() sets is_locked_by_uuid and changes state to Running.
+      $arv->{'jobs'}->{'lock'}->execute('uuid' => $Job->{'uuid'})
+    };
+    if ($@) {
+      Log(undef, "Error while locking job, exiting ".EX_TEMPFAIL);
+      exit EX_TEMPFAIL;    
+    };
   }
 }
 else
@@ -190,6 +175,7 @@ else
   }
 
   $Job->{'is_locked_by_uuid'} = $User->{'uuid'};
+  $Job->{'state'} = 'Running';
   $Job->{'started_at'} = gmtime;
 
   $Job = $arv->{'jobs'}->{'create'}->execute('job' => $Job);
@@ -281,27 +267,11 @@ foreach (@sinfo)
 @slot = sort { $a->{cpu} <=> $b->{cpu} } @slot;
 
 
-
-my $jobmanager_id;
-if ($job_has_uuid)
-{
-  # Claim this job, and make sure nobody else does
-  eval {
-    $arv->{'jobs'}->{'lock'}->execute('uuid' => $Job->{'uuid'})
-  };
-  if ($@) {
-    Log(undef, "Error while locking job, exiting ".EX_TEMPFAIL);
-    exit EX_TEMPFAIL;    
-  };
-
-  # lock() above sets is_locked_by_uuid and changes state to Running.
-  $Job->update_attributes(
-    'tasks_summary' => { 'failed' => 0,
-                         'todo' => 1,
-                         'running' => 0,
-                         'done' => 0 });
-}
-
+$Job->update_attributes(
+  'tasks_summary' => { 'failed' => 0,
+                       'todo' => 1,
+                       'running' => 0,
+                       'done' => 0 });
 
 Log (undef, "start");
 $SIG{'INT'} = sub { $main::please_freeze = 1; };

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list