[ARVADOS] created: abd90a9194482bb75b471afc0f11fba8bce786c7

Git user git at public.curoverse.com
Fri Jun 9 15:07:37 EDT 2017


        at  abd90a9194482bb75b471afc0f11fba8bce786c7 (commit)


commit abd90a9194482bb75b471afc0f11fba8bce786c7
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Jun 9 14:25:59 2017 -0400

    11642: Don't reuse completed jobs where output or log is null or not readable by current user.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curoverse.com>

diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index fa38ece..84beab3 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -275,12 +275,18 @@ class Job < ArvadosModel
         # Ignore: we have already decided not to reuse any completed
         # job.
         log_reuse_info { "job #{j.uuid} with output #{j.output} ignored, see above" }
+      elsif j.output.nil?
+        log_reuse_info { "job #{j.uuid} has nil output" }
+      elsif j.log.nil?
+        log_reuse_info { "job #{j.uuid} has nil log" }
+      elsif !Collection.readable_by(current_user).find_by_portable_data_hash(j.log)
+        log_reuse_info { "job #{j.uuid} log #{j.log} unavailable to user; continuing search" }
       elsif Rails.configuration.reuse_job_if_outputs_differ
         if Collection.readable_by(current_user).find_by_portable_data_hash(j.output)
           log_reuse_info { "job #{j.uuid} with output #{j.output} is reusable; decision is final." }
           return j
         else
-          # Ignore: keep locking for an incomplete job or one whose
+          # Ignore: keep looking for an incomplete job or one whose
           # output is readable.
           log_reuse_info { "job #{j.uuid} output #{j.output} unavailable to user; continuing search" }
         end
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 809ba0e..abd2dca 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -183,6 +183,23 @@ previous_job_run:
   state: Complete
   script_parameters_digest: a5f03bbfb8ba88a2efe4a7852671605b
 
+previous_job_run_nil_log:
+  uuid: zzzzz-8i9sb-cjs4pklxxjykqq3
+  created_at: <%= 14.minute.ago.to_s(:db) %>
+  finished_at: <%= 13.minutes.ago.to_s(:db) %>
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  repository: active/foo
+  script: hash
+  script_version: 4fe459abe02d9b365932b8f5dc419439ab4e2577
+  script_parameters:
+    input: fa7aeb5140e2848d39b416daeef4ffc5+45
+    an_integer: "3"
+  success: true
+  log: ~
+  output: ea10d51bcf88862dbcc36eb292017dfd+45
+  state: Complete
+  script_parameters_digest: 445702df4029b8a6e7075b451ff1256a
+
 previous_ancient_job_run:
   uuid: zzzzz-8i9sb-ahd7cie8jah9qui
   created_at: <%= 366.days.ago.to_s(:db) %>
@@ -217,6 +234,7 @@ previous_docker_job_run:
   docker_image_locator: fa3c1a9cb6783f85f2ecda037e07b8c3+167
   state: Complete
   script_parameters_digest: a5f03bbfb8ba88a2efe4a7852671605b
+  log: ea10d51bcf88862dbcc36eb292017dfd+45
 
 previous_ancient_docker_image_job_run:
   uuid: zzzzz-8i9sb-t3b460aolxxuldl
@@ -255,6 +273,7 @@ previous_job_run_with_arvados_sdk_version:
   output: ea10d51bcf88862dbcc36eb292017dfd+45
   state: Complete
   script_parameters_digest: a5f03bbfb8ba88a2efe4a7852671605b
+  log: ea10d51bcf88862dbcc36eb292017dfd+45
 
 previous_job_run_no_output:
   uuid: zzzzz-8i9sb-cjs4pklxxjykppp
diff --git a/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb b/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb
index 8007fd2..afd0512 100644
--- a/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/job_reuse_controller_test.rb
@@ -50,6 +50,26 @@ class Arvados::V1::JobReuseControllerTest < ActionController::TestCase
     assert_equal '4fe459abe02d9b365932b8f5dc419439ab4e2577', new_job['script_version']
   end
 
+  test "no reuse job with null log" do
+    post :create, {
+      job: {
+        script: "hash",
+        script_version: "4fe459abe02d9b365932b8f5dc419439ab4e2577",
+        repository: "active/foo",
+        script_parameters: {
+          input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
+          an_integer: '3'
+        }
+      },
+      find_or_create: true
+    }
+    assert_response :success
+    assert_not_nil assigns(:object)
+    new_job = JSON.parse(@response.body)
+    assert_not_equal 'zzzzz-8i9sb-cjs4pklxxjykqq3', new_job['uuid']
+    assert_equal '4fe459abe02d9b365932b8f5dc419439ab4e2577', new_job['script_version']
+  end
+
   test "reuse job with symbolic script_version" do
     post :create, {
       job: {

commit 7899dbfa16983e230aa26766d01182cfb27259d1
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Jun 9 13:27:51 2017 -0400

    11642: Increase arv-put retries.  Job considered failure if unable to save job log.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curoverse.com>

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index 55e35b0..35a3b1f 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -1130,10 +1130,10 @@ freeze();
 my $collated_output = save_output_collection();
 Log (undef, "finish");
 
-save_meta();
+my $final_log = save_meta();
 
 my $final_state;
-if ($collated_output && $main::success) {
+if ($collated_output && $final_log && $main::success) {
   $final_state = 'Complete';
 } else {
   $final_state = 'Failed';
@@ -1760,7 +1760,7 @@ sub log_writer_start($)
   $log_pipe_pid = open2($log_pipe_out, $log_pipe_in,
                         'arv-put',
                         '--stream',
-                        '--retries', '3',
+                        '--retries', '6',
                         '--filename', $logfilename,
                         '-');
   $log_pipe_out_buf = "";
@@ -1898,6 +1898,8 @@ sub save_meta
     });
   Log(undef, "log collection is " . $log_coll->{portable_data_hash});
   $Job->update_attributes('log' => $log_coll->{portable_data_hash});
+
+  return $log_coll->{portable_data_hash};
 }
 
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list