X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9daebff7dfeaa7092da078f3a0bfdc0c9d8e51e0..2861857a87d4c40924f783862ee09e91cec0b96f:/sdk/cli/bin/arv-run-pipeline-instance?ds=sidebyside diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance index 040a71db2c..ded7ab1520 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)