[ARVADOS] updated: 2861857a87d4c40924f783862ee09e91cec0b96f
git at public.curoverse.com
git at public.curoverse.com
Thu Sep 25 15:01:52 EDT 2014
Summary of changes:
apps/workbench/app/helpers/pipeline_instances_helper.rb | 14 ++++++++++----
.../app/views/application/_job_status_label.html.erb | 2 +-
.../pipeline_instances/_running_component.html.erb | 2 +-
sdk/cli/bin/arv-run-pipeline-instance | 17 ++++++-----------
sdk/cli/bin/crunch-job | 12 +++++++-----
5 files changed, 25 insertions(+), 22 deletions(-)
via 2861857a87d4c40924f783862ee09e91cec0b96f (commit)
from 9daebff7dfeaa7092da078f3a0bfdc0c9d8e51e0 (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 2861857a87d4c40924f783862ee09e91cec0b96f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Sep 25 15:01:44 2014 -0400
3899: Shorten count of ended/succeed/failed in a-r-p-i with some clever Ruby.
Improve reporting to test for state == Cancelled instead of looking at
cancelled_at, and distinguish between cancelled the state being unexpectedly
changed to success/failed. pipeline_instances_helper uses state attribute.
diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index 7e5324b..ca48306 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -132,19 +132,25 @@ module PipelineInstancesHelper
pj[:progress] = 0.0
end
end
- if pj[:job][:success]
+
+ case pj[:job][:state]
+ when 'Complete'
pj[:result] = 'complete'
pj[:labeltype] = 'success'
pj[:complete] = true
pj[:progress] = 1.0
- elsif pj[:job][:finished_at]
+ when 'Failed'
pj[:result] = 'failed'
pj[:labeltype] = 'danger'
pj[:failed] = true
- elsif pj[:job][:started_at]
+ when 'Cancelled'
+ pj[:result] = 'cancelled'
+ pj[:labeltype] = 'danger'
+ pj[:failed] = true
+ when 'Running'
pj[:result] = 'running'
pj[:labeltype] = 'primary'
- elsif pj[:job][:uuid]
+ when 'Queued'
pj[:result] = 'queued'
pj[:labeltype] = 'default'
else
diff --git a/apps/workbench/app/views/application/_job_status_label.html.erb b/apps/workbench/app/views/application/_job_status_label.html.erb
index ece8167..0d012db 100644
--- a/apps/workbench/app/views/application/_job_status_label.html.erb
+++ b/apps/workbench/app/views/application/_job_status_label.html.erb
@@ -1,4 +1,4 @@
-<% status = Job.state j %>
+<% status = Job::state j %>
<% to_label = {
"Cancelled" => "danger",
"Complete" => "success",
diff --git a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
index 1d52e28..be3aba8 100644
--- a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
@@ -31,7 +31,7 @@
<% end %>
</div>
- <% if Job::state(current_job).in? ["Complete", "Failed", "Canceled"] %>
+ <% if Job::state(current_job).in? ["Complete", "Failed", "Cancelled"] %>
<div class="col-md-5 text-overflow-ellipsis">
<% if pj[:output_uuid] %>
<%= link_to_if_arvados_object pj[:output_uuid], friendly_name: true %>
diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance
index 040a71d..ded7ab1 100755
--- a/sdk/cli/bin/arv-run-pipeline-instance
+++ b/sdk/cli/bin/arv-run-pipeline-instance
@@ -686,17 +686,12 @@ class WhRunPipelineInstance
end
end
- ended = @components.map { |cname, c|
- if c[:job] and ["Complete", "Failed", "Cancelled"].include? c[:job][:state] then 1 else 0 end
- }.reduce(:+) || 0
-
- succeeded = @components.map { |cname, c|
- if c[:job] and ["Complete"].include? c[:job][:state] then 1 else 0 end
- }.reduce(:+) || 0
-
- failed = @components.map { |cname, c|
- if c[:job] and ["Failed", "Cancelled"].include? c[:job][:state] then 1 else 0 end
- }.reduce(:+) || 0
+ c_in_state = @components.values.group_by { |c|
+ c[:job] and c[:job][:state]
+ }
+ succeeded = c_in_state["Complete"].count
+ failed = c_in_state["Failed"].count + c_in_state["Cancelled"].count
+ ended = succeeded + failed
success = (succeeded == @components.length)
diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index fbd7bef..f56099d 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -1042,8 +1042,11 @@ sub check_refresh_wanted
$Job->{$attr} = $Job2->{$attr};
}
if ($Job->{'state'} ne "Running") {
- Log (undef, "Job state changed to " . $Job->{'state'} . " at " . $Job->{cancelled_at} .
- " by user " . $Job->{cancelled_by_user_uuid});
+ if ($Job->{'state'} eq "Cancelled") {
+ Log (undef, "Job cancelled at " . $Job->{'cancelled_at'} . " by user " . $Job->{'cancelled_by_user_uuid'});
+ } else {
+ Log (undef, "Job state unexpectedly changed to " . $Job->{'state'});
+ }
$main::success = 0;
$main::please_freeze = 1;
}
@@ -1341,9 +1344,8 @@ sub croak
sub cleanup
{
return if !$job_has_uuid;
- if ($Job->{'cancelled_at'}) {
- $Job->update_attributes('state' => 'Cancelled',
- 'finished_at' => scalar gmtime);
+ if ($Job->{'state'} eq 'Cancelled') {
+ $Job->update_attributes('finished_at' => scalar gmtime);
} else {
$Job->update_attributes('state' => 'Failed');
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list