[ARVADOS] updated: ce9a082de2eea0f27c0ee393299df16d98eb9fe5

git at public.curoverse.com git at public.curoverse.com
Mon Apr 21 19:06:34 EDT 2014


Summary of changes:
 services/api/app/models/pipeline_instance.rb     |   14 ++++++++++----
 services/api/test/unit/pipeline_instance_test.rb |    8 ++++----
 2 files changed, 14 insertions(+), 8 deletions(-)

       via  ce9a082de2eea0f27c0ee393299df16d98eb9fe5 (commit)
      from  ad21f6e75f89d2bc5b6547ccf84332384478f82b (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 ce9a082de2eea0f27c0ee393299df16d98eb9fe5
Author: radhika chippada <radhika at curoverse.com>
Date:   Mon Apr 21 19:06:12 2014 -0400

    Check if a parameter is required in is_ready method

diff --git a/services/api/app/models/pipeline_instance.rb b/services/api/app/models/pipeline_instance.rb
index fce607a..9414fa8 100644
--- a/services/api/app/models/pipeline_instance.rb
+++ b/services/api/app/models/pipeline_instance.rb
@@ -79,10 +79,16 @@ class PipelineInstance < ArvadosModel
 
     all_components_have_input = true
     components.each do |name, component|
-      if !component.andand['script_parameters'].andand['input'] || 
-          component.andand['script_parameters'].andand['input'].empty?
-        all_components_have_input = false
-        break
+      component['script_parameters'].each do |parametername, parameter|
+        parameter = { 'value' => parameter } unless parameter.is_a? Hash
+        if parameter['value'].nil? and
+            ![false,'false',0,'0'].index parameter['required']
+          if parameter['output_of']
+            next
+          end          
+          all_components_have_input = false
+          break
+        end
       end
     end
     return all_components_have_input
diff --git a/services/api/test/unit/pipeline_instance_test.rb b/services/api/test/unit/pipeline_instance_test.rb
index c6aae4d..ff2cfd3 100644
--- a/services/api/test/unit/pipeline_instance_test.rb
+++ b/services/api/test/unit/pipeline_instance_test.rb
@@ -21,12 +21,12 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi = pipeline_instances :new_pipeline
 
     # add a component with no input and expect state to be New
-    component = {'script_parameters' => {"something" => "c1bad4b39ca5a924e481008009d94e32+210"}}
+    component = {'script_parameters' => {"input_not_provided" => {"required" => "true"}}}
     pi.components['first'] = component
     components = pi.components
     pi.update_attribute 'components', pi.components
     pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
-    assert_equal PipelineInstance::New, pi.state, 'expected state to be Ready after adding component with input'
+    assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 1, 'expected one component'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false for a new pipeline'
@@ -66,13 +66,13 @@ class PipelineInstanceTest < ActiveSupport::TestCase
 
     # add two components, one with input and one with no input and expect state to be New
     component1 = {'script_parameters' => {"something" => "xxxad4b39ca5a924e481008009d94e32+210", "input" => "c1bad4b39ca5a924e481008009d94e32+210"}}
-    component2 = {'script_parameters' => {"something_else" => "xxxad4b39ca5a924e481008009d94e32+210", "not_input" => "c1bad4b39ca5a924e481008009d94e32+210"}}
+    component2 = {'script_parameters' => {"something_else" => "xxxad4b39ca5a924e481008009d94e32+210", "input_missing" => {"required" => "true"}}}
     pi.components['first'] = component1
     pi.components['second'] = component2
     components = pi.components
     pi.update_attribute 'components', pi.components
     pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
-    assert_equal PipelineInstance::New, pi.state, 'expected state to be Ready after adding component with input'
+    assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 2, 'expected two components'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false for a new pipeline'

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list