20846: Merge branch '19213-ubuntu2204-support' into 20846-ubuntu2204
[arvados.git] / apps / workbench / app / controllers / work_units_controller.rb
index 8c4e5e7d9f3f5c64ebb04e4175710c46eefab4ff..42dd12a4c2f4cf2678e1387710a846d6d2135bd6 100644 (file)
@@ -70,7 +70,7 @@ class WorkUnitsController < ApplicationController
       workflow = Workflow.find? template_uuid
       if workflow.definition
         begin
-          wf_json = ActiveSupport::HashWithIndifferentAccess.new YAML::load(workflow.definition)
+          wf_json = ActiveSupport::HashWithIndifferentAccess.new YAML.load(workflow.definition)
         rescue => e
           logger.error "Error converting definition yaml to json: #{e.message}"
           raise ArgumentError, "Error converting definition yaml to json: #{e.message}"
@@ -83,6 +83,7 @@ class WorkUnitsController < ApplicationController
       attrs['properties'] = {'template_uuid' => template_uuid}
       attrs['priority'] = 1
       attrs['state'] = "Uncommitted"
+      attrs['use_existing'] = false
 
       # required
       attrs['container_image'] = "arvados/jobs"
@@ -117,12 +118,16 @@ class WorkUnitsController < ApplicationController
               if hint[:keep_cache]
                 keep_cache = hint[:keep_cache]
               end
+              if hint[:acrContainerImage]
+                attrs['container_image'] = hint[:acrContainerImage]
+              end
             end
           end
         end
       end
 
       attrs['command'] = ["arvados-cwl-runner",
+                          "--enable-reuse",
                           "--local",
                           "--api=containers",
                           "--project-uuid=#{params['work_unit']['owner_uuid']}",