X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7fae6271dd3b05db5a7f084cf686f7388e2822db..91dc5f1d7f5ad9eb2640f6089e2d0476cbf87c8e:/sdk/cli/bin/arv-run-pipeline-instance diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance index 3e72658d47..bcb11d1d70 100755 --- a/sdk/cli/bin/arv-run-pipeline-instance +++ b/sdk/cli/bin/arv-run-pipeline-instance @@ -1,63 +1,5 @@ #!/usr/bin/env ruby -# == Synopsis -# -# arv-run-pipeline-instance --template pipeline-template-uuid [options] [--] [parameters] -# arv-run-pipeline-instance --instance pipeline-instance-uuid [options] -# -# Satisfy a pipeline template by finding or submitting a mapreduce job -# for each pipeline component. -# -# == Options -# -# [--template uuid] Use the specified pipeline template. -# -# [--template path] Load the pipeline template from the specified -# local file. -# -# [--instance uuid] Use the specified pipeline instance. -# -# [-n, --dry-run] Do not start any new jobs or wait for existing jobs -# to finish. Just find out whether jobs are finished, -# queued, or running for each component -# -# [--submit] Do not try to satisfy any components. Just -# create an instance, print its UUID to -# stdout, and exit. -# -# [--no-wait] Make only as much progress as possible without entering -# a sleep/poll loop. -# -# [--no-reuse] Do not reuse existing jobs to satisfy pipeline -# components. Submit a new job for every component. -# -# [--debug] Print extra debugging information on stderr. -# -# [--debug-level N] Increase amount of debugging information. Default -# 1, possible range 0..3. -# -# [--status-text path] Print plain text status report to a file or -# fifo. Default: /dev/stdout -# -# [--status-json path] Print JSON status report to a file or -# fifo. Default: /dev/null -# -# [--description] Description for the pipeline instance. -# -# == Parameters -# -# [param_name=param_value] -# -# [param_name param_value] Set (or override) the default value for -# every parameter with the given name. -# -# [component_name::param_name=param_value] -# [component_name::param_name param_value] -# [--component_name::param_name=param_value] -# [--component_name::param_name param_value] Set the value of a -# parameter for a single -# component. -# class WhRunPipelineInstance end @@ -75,7 +17,7 @@ begin require 'trollop' require 'google/api_client' rescue LoadError => l - puts $: + $stderr.puts $: abort <<-EOS #{$0}: fatal: #{l.message} Some runtime dependencies may be missing. @@ -92,6 +34,28 @@ end p = Trollop::Parser.new do version __FILE__ + banner(< :boolean, @@ -168,7 +132,7 @@ if $options[:instance] abort "#{$0}: syntax error: --instance cannot be combined with --template or --submit." end elsif not $options[:template] - puts "error: you must supply a --template or --instance." + $stderr.puts "error: you must supply a --template or --instance." p.educate abort end @@ -400,22 +364,25 @@ class WhRunPipelineInstance @components.each do |componentname, component| component[:script_parameters].each do |parametername, parameter| parameter = { :value => parameter } unless parameter.is_a? Hash - value = - (params["#{componentname}::#{parametername}"] || - parameter[:value] || - (parameter[:output_of].nil? && - (params[parametername.to_s] || - parameter[:default])) || - nil) - if value.nil? and - ![false,'false',0,'0'].index parameter[:required] - if parameter[:output_of] - if not @components[parameter[:output_of].intern] - errors << [componentname, parametername, "output_of refers to nonexistent component '#{parameter[:output_of]}'"] - end - next + if params.has_key?("#{componentname}::#{parametername}") + value = params["#{componentname}::#{parametername}"] + elsif parameter.has_key?(:value) + value = parameter[:value] + elsif parameter.has_key?(:output_of) + if !@components[parameter[:output_of].intern] + errors << [componentname, parametername, "output_of refers to nonexistent component '#{parameter[:output_of]}'"] + else + # value will be filled in later when the upstream + # component's output becomes known end + next + elsif params.has_key?(parametername.to_s) + value = params[parametername.to_s] + elsif parameter.has_key?(:default) + value = parameter[:default] + else errors << [componentname, parametername, "required parameter is missing"] + next end debuglog "parameter #{componentname}::#{parametername} == #{value}"