[ARVADOS] created: 67e6092c464fcce21eecf79b93366231820e7705
git at public.curoverse.com
git at public.curoverse.com
Thu Nov 13 17:12:07 EST 2014
at 67e6092c464fcce21eecf79b93366231820e7705 (commit)
commit 67e6092c464fcce21eecf79b93366231820e7705
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Nov 13 17:12:05 2014 -0500
4035: Looks for "tooldescription" in the component, if found, processes common-workflow-language and submits a run-command from that.
diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance
index 63313fc..51f82d6 100755
--- a/sdk/cli/bin/arv-run-pipeline-instance
+++ b/sdk/cli/bin/arv-run-pipeline-instance
@@ -521,28 +521,89 @@ class WhRunPipelineInstance
# are fully specified (any output_of script_parameters are resolved
# to real value)
my_submit_id = "instance #{@instance[:uuid]} rand #{rand(2**64).to_s(36)}"
- job = JobCache.create(@instance, cname, {
- :script => c[:script],
- :script_parameters => Hash[c[:script_parameters].map do |key, spec|
- [key, spec[:value]]
- end],
- :script_version => c[:script_version],
- :repository => c[:repository],
- :nondeterministic => c[:nondeterministic],
- :runtime_constraints => c[:runtime_constraints],
- :owner_uuid => owner_uuid,
- :is_locked_by_uuid => (@options[:run_jobs_here] ? owner_uuid : nil),
- :submit_id => my_submit_id,
- :state => (if @options[:run_jobs_here] then "Running" else "Queued" end)
- }, {
- # This is the right place to put these attributes when
- # dealing with new API servers.
- :minimum_script_version => c[:minimum_script_version],
- :exclude_script_versions => c[:exclude_minimum_script_versions],
- :find_or_create => (@instance[:properties][:run_options].andand[:enable_job_reuse] &&
- !c[:nondeterministic]),
- :filters => c[:filters]
- })
+
+ if c[:tooldescription]
+ require 'shellwords'
+ # command workflow language tool description
+ tooldesc = JSON.load(`arv-get #{c[:tooldescription].shellescape}`)
+ if $?.exitstatus == 0
+ require 'tempfile'
+ tooldesc_file = Tempfile.new('tooldesc')
+ jobdesc_file = Tempfile.new('jobdesc')
+ begin
+ tooldesc_file.write(tooldesc.to_json)
+ tooldesc_file.close
+
+ jobdesc_file.write({"inputs" => Hash[c[:script_parameters].map do |key, spec|
+ [key, spec[:value]]
+ end]}.to_json)
+ jobdesc_file.close
+
+ args = JSON.load(`cwltool --conformance-test --no-container --basedir=/keep #{tooldesc_file.path} #{jobdesc_file.path}`)
+ script_parameters = {}
+ script_parameters["command"] = args["args"]
+ script_parameters["task.stdout"] = args["stdout"]
+ script_parameters["task.stdin"] = args["stdin"]
+
+ runtime_constraints = {}
+ container = tooldesc["requirements"].andand["environment"].andand["container"]
+ if container and container["type"] == "docker"
+ runtime_constraints["docker_image"] = container["imageId"]
+ end
+
+ job = JobCache.create(@instance, cname, {
+ :script => "run-command",
+ :script_parameters => script_parameters,
+ :script_version => "master",
+ :repository => "arvados",
+ :nondeterministic => c[:nondeterministic],
+ :runtime_constraints => runtime_constraints,
+ :owner_uuid => owner_uuid,
+ :is_locked_by_uuid => (@options[:run_jobs_here] ? owner_uuid : nil),
+ :submit_id => my_submit_id,
+ :state => (if @options[:run_jobs_here] then "Running" else "Queued" end)
+ }, {
+ # This is the right place to put these attributes when
+ # dealing with new API servers.
+ :minimum_script_version => c[:minimum_script_version],
+ :exclude_script_versions => c[:exclude_minimum_script_versions],
+ :find_or_create => (@instance[:properties][:run_options].andand[:enable_job_reuse] &&
+ !c[:nondeterministic]),
+ :filters => c[:filters]
+ })
+
+ ensure
+ tooldesc_file.unlink
+ jobdesc_file.unlink
+ end
+ else
+ debuglog "component #{cname} new job failed with output #{tooldesc}", 0
+ job_creation_failed += 1
+ end
+ else
+ job = JobCache.create(@instance, cname, {
+ :script => c[:script],
+ :script_parameters => Hash[c[:script_parameters].map do |key, spec|
+ [key, spec[:value]]
+ end],
+ :script_version => c[:script_version],
+ :repository => c[:repository],
+ :nondeterministic => c[:nondeterministic],
+ :runtime_constraints => c[:runtime_constraints],
+ :owner_uuid => owner_uuid,
+ :is_locked_by_uuid => (@options[:run_jobs_here] ? owner_uuid : nil),
+ :submit_id => my_submit_id,
+ :state => (if @options[:run_jobs_here] then "Running" else "Queued" end)
+ }, {
+ # This is the right place to put these attributes when
+ # dealing with new API servers.
+ :minimum_script_version => c[:minimum_script_version],
+ :exclude_script_versions => c[:exclude_minimum_script_versions],
+ :find_or_create => (@instance[:properties][:run_options].andand[:enable_job_reuse] &&
+ !c[:nondeterministic]),
+ :filters => c[:filters]
+ })
+ end
if job
debuglog "component #{cname} new job #{job[:uuid]}"
c[:job] = job
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list