[ARVADOS] updated: 52738977b2715822954692a566049b7ebf54e7cc
git at public.curoverse.com
git at public.curoverse.com
Mon Oct 6 12:30:43 EDT 2014
Summary of changes:
services/api/app/models/job.rb | 2 +-
services/api/app/models/user.rb | 24 ++++++++++++++++
.../test/fixtures/api_client_authorizations.yml | 6 ++++
services/api/test/fixtures/collections.yml | 8 ++++++
services/api/test/fixtures/groups.yml | 9 ++++++
services/api/test/fixtures/links.yml | 33 ++++++++++++++++++++++
services/api/test/fixtures/users.yml | 22 +++++++++++++++
.../functional/arvados/v1/jobs_controller_test.rb | 33 +++++++++++-----------
.../functional/arvados/v1/links_controller_test.rb | 18 ++++++++++++
9 files changed, 138 insertions(+), 17 deletions(-)
via 52738977b2715822954692a566049b7ebf54e7cc (commit)
via 2dbf4bb77bb1ec3df58350a3982da1c77bc0e527 (commit)
via fb036b6bb6a63d4cf0e05f7b0fc3bae0ff1ef026 (commit)
via 86b14bac0b6413dd033285a4357cc7edd05a22b3 (commit)
via b7c8b1cc7d646c99493558ab20d3b313eb7b2d9f (commit)
via 8018af97c6ac3ca2d6b7acf8dd7c21ee0f290436 (commit)
via bb8669fd6be817468769fd5dd3faeed54f1e1888 (commit)
via d7d1d0f327ddc42d2d06b836863f51e09793894b (commit)
via e79e5c258fe6ec542c3f2bb3c4230a5de2812b25 (commit)
via 49c507b0bb60e35b951e2f4946c28d7c6729ce88 (commit)
via fd7a118e0c88693efdb3662a5bd70b7cdb58eda3 (commit)
from 38738bf78bac4a083195cfd44124332abcce6400 (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 52738977b2715822954692a566049b7ebf54e7cc
Merge: 2dbf4bb fb036b6
Author: radhika <radhika at curoverse.com>
Date: Mon Oct 6 12:30:35 2014 -0400
Merge branch 'master' into 3882-cancel-already-cancelled-job
commit 2dbf4bb77bb1ec3df58350a3982da1c77bc0e527
Author: radhika <radhika at curoverse.com>
Date: Mon Oct 6 12:24:29 2014 -0400
3882: Change "update_timestamps_when_state_changes" from before_validation to after_validation,
so that update of success and running flags is done AFTER ensuring the state change is valid.
Otherwise, the update to success and running flags is resulting in overriding the actual state update.
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 4b86be7..56c070c 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -9,12 +9,12 @@ class Job < ArvadosModel
before_create :ensure_unique_submit_id
after_commit :trigger_crunch_dispatch_if_cancelled, :on => :update
before_validation :set_priority
- before_validation :update_timestamps_when_state_changes
before_validation :update_state_from_old_state_attrs
validate :ensure_script_version_is_commit
validate :find_docker_image_locator
validate :validate_status
validate :validate_state_change
+ after_validation :update_timestamps_when_state_changes
has_many :commit_ancestors, :foreign_key => :descendant, :primary_key => :script_version
has_many(:nodes, foreign_key: :job_uuid, primary_key: :uuid)
commit b7c8b1cc7d646c99493558ab20d3b313eb7b2d9f
Merge: 38738bf 8018af9
Author: radhika <radhika at curoverse.com>
Date: Mon Oct 6 11:04:10 2014 -0400
Merge branch '3882-cancel-already-cancelled-job-TC' into 3882-cancel-already-cancelled-job
commit 8018af97c6ac3ca2d6b7acf8dd7c21ee0f290436
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 6 09:59:36 2014 -0400
3882: refactor update-or-cancel code.
diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index c28cdf7..7f4b9d5 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -102,14 +102,14 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
end
[
- ['cancelled_at', Time.now, :success],
- ['state', 'Cancelled', :success],
- ['state', 'Running', :unprocessable_entity],
- ['state', 'Failed', :unprocessable_entity],
- ['state', 'Complete', :unprocessable_entity],
- [:use_action, :cancel, :success],
- ].each do |attribute, value, expected_response|
- test "cancelled job stays cancelled when updated using #{attribute} #{value}" do
+ [:put, :update, {job:{cancelled_at: Time.now}}, :success],
+ [:put, :update, {job:{state: 'Cancelled'}}, :success],
+ [:put, :update, {job:{state: 'Running'}}, :unprocessable_entity],
+ [:put, :update, {job:{state: 'Failed'}}, :unprocessable_entity],
+ [:put, :update, {job:{state: 'Complete'}}, :unprocessable_entity],
+ [:post, :cancel, {}, :success],
+ ].each do |http_method, action, params, expected_response|
+ test "cancelled job stays cancelled after #{[http_method, action, params].inspect}" do
# We need to verify that "cancel" creates a trigger file, so first
# let's make sure there is no stale trigger file.
begin
@@ -118,20 +118,15 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
end
authorize_with :active
- if attribute == :use_action
- post value, { id: jobs(:cancelled).uuid }
- else
- put :update, {
- id: jobs(:cancelled).uuid,
- job: {
- attribute => value
- }
- }
- end
+ self.send http_method, action, { id: jobs(:cancelled).uuid }.merge(params)
assert_response expected_response
- job = json_response
- assert_not_nil job['cancelled_at'], 'job cancelled again using #{attribute}=#{value} did not have cancelled_at value'
- assert_equal job['state'], 'Cancelled', 'cancelled again job state changed when updated using using #{attribute}=#{value}'
+ if expected_response == :success
+ job = json_response
+ assert_not_nil job['cancelled_at'], 'job cancelled again using #{attribute}=#{value} did not have cancelled_at value'
+ assert_equal job['state'], 'Cancelled', 'cancelled again job state changed when updated using using #{attribute}=#{value}'
+ end
+ # Verify database record still says Cancelled
+ assert_equal 'Cancelled', Job.find(jobs(:cancelled).id).state, 'job was un-cancelled'
end
end
commit bb8669fd6be817468769fd5dd3faeed54f1e1888
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 6 09:41:25 2014 -0400
3882: Test response status and #cancel method.
diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index a3d4452..c28cdf7 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -102,12 +102,13 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
end
[
- ['cancelled_at', Time.now],
- ['state', 'Cancelled'],
- ['state', 'Running'],
- ['state', 'Failed'],
- ['state', 'Complete'],
- ].each do |attribute, value|
+ ['cancelled_at', Time.now, :success],
+ ['state', 'Cancelled', :success],
+ ['state', 'Running', :unprocessable_entity],
+ ['state', 'Failed', :unprocessable_entity],
+ ['state', 'Complete', :unprocessable_entity],
+ [:use_action, :cancel, :success],
+ ].each do |attribute, value, expected_response|
test "cancelled job stays cancelled when updated using #{attribute} #{value}" do
# We need to verify that "cancel" creates a trigger file, so first
# let's make sure there is no stale trigger file.
@@ -117,13 +118,18 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
end
authorize_with :active
- put :update, {
- id: jobs(:cancelled).uuid,
- job: {
- attribute => value
+ if attribute == :use_action
+ post value, { id: jobs(:cancelled).uuid }
+ else
+ put :update, {
+ id: jobs(:cancelled).uuid,
+ job: {
+ attribute => value
+ }
}
- }
- job = JSON.parse(@response.body)
+ end
+ assert_response expected_response
+ job = json_response
assert_not_nil job['cancelled_at'], 'job cancelled again using #{attribute}=#{value} did not have cancelled_at value'
assert_equal job['state'], 'Cancelled', 'cancelled again job state changed when updated using using #{attribute}=#{value}'
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list