Skip to content
8 changes: 7 additions & 1 deletion lib/workflowmgr/cobaltbatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,17 @@ def submit(task)
WorkflowMgr.stderr("Submitting #{task.attributes[:name]} using #{cmd} --mode script #{tf.path} with input {{#{input}}}",4)

# Run the submit command
output=`#{cmd} --mode script #{tf.path} 2>&1`.chomp()
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`#{cmd} --mode script #{tf.path} 2>&1`.chomp()
end

# Parse the output of the submit command
if output=~/^(\d+)$/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
else
return nil,output
end
Expand Down
8 changes: 7 additions & 1 deletion lib/workflowmgr/lsfbatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,20 @@ def submit(task)
tf.flush()

# Run the submit command script
output=`/bin/sh #{tf.path} 2>&1`.chomp
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`/bin/sh #{tf.path} 2>&1`.chomp
end

WorkflowMgr.log("Submitted #{task.attributes[:name]} using '/bin/sh #{tf.path} 2>&1' with input {{#{envstr + cmd}}}")
WorkflowMgr.stderr("Submitted #{task.attributes[:name]} using '/bin/sh #{tf.path} 2>&1' with input {{#{envstr + cmd}}}",4)

# Parse the output of the submit command
if output=~/Job <(\d+)> is submitted to (default )*queue/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
else
return nil,output
end
Expand Down
8 changes: 7 additions & 1 deletion lib/workflowmgr/lsfcraybatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,20 @@ def submit(task)
tf.flush()

# Run the submit command script
output=`/bin/sh #{tf.path} 2>&1`.chomp
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`/bin/sh #{tf.path} 2>&1`.chomp
end

WorkflowMgr.log("Submitted #{task.attributes[:name]} using '/bin/sh #{tf.path} 2>&1' with input {{#{envstr + cmd}}}")
WorkflowMgr.stderr("Submitted #{task.attributes[:name]} using '/bin/sh #{tf.path} 2>&1' with input {{#{envstr + cmd}}}",4)

# Parse the output of the submit command
if output=~/Job <(\d+)> is submitted to (default )*queue/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
else
return nil,output
end
Expand Down
8 changes: 7 additions & 1 deletion lib/workflowmgr/moabbatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,17 @@ def submit(task)
WorkflowMgr.stderr("Submitting #{task.attributes[:name]} using #{cmd} < #{tf.path} with input {{#{input}}}",4)

# Run the submit command
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
end

# Parse the output of the submit command
if output=~/^((\w+\.)*\d+)$/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
else
return nil,output
end
Expand Down
8 changes: 7 additions & 1 deletion lib/workflowmgr/pbsprobatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,17 @@ def submit(task)
WorkflowMgr.stderr("Submitting #{task.attributes[:name]} using #{cmd} < #{tf.path} with input {{#{input}}}",4)

# Run the submit command
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
end

# Parse the output of the submit command
if output=~/^(\d+)(\.[a-zA-Z0-9-]+)*$/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
else
return nil,output
end
Expand Down
11 changes: 11 additions & 0 deletions lib/workflowmgr/reportoption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ReportOption
attr_reader :database
attr_reader :workflowdoc
attr_reader :verbose
attr_reader :dryrun

##########################################
#
Expand All @@ -28,6 +29,7 @@ def initialize(args)
@database=nil
@workflowdoc=nil
@verbose=0
@dryrun=0
parse(args)

end # initialize
Expand Down Expand Up @@ -72,6 +74,12 @@ def parse(args)
WorkflowMgr.const_set("VERBOSE",@verbose)
end

# Handle option for dryrun
opts.on("-n","--dryrun","Show Workflow Manager commands, but do not execute") do |dryrun|
@dryrun=1
WorkflowMgr.const_set("DRYRUN",@dryrun)
end

# Handle option for version
opts.on("--version","Show Workflow Manager version") do
puts "Workflow Manager Version #{WorkflowMgr.version}"
Expand All @@ -94,6 +102,9 @@ def parse(args)
# Set verbose to 0 if not set by options
WorkflowMgr.const_set("VERBOSE",0) unless WorkflowMgr.const_defined?("VERBOSE")

# Set dryrun to 0 if not set by options
WorkflowMgr.const_set("DRYRUN",0) unless WorkflowMgr.const_defined?("DRYRUN")

# The -d and -w options are mandatory
raise OptionParser::ParseError,"A database file must be specified" if @database.nil?
raise OptionParser::ParseError,"A workflow definition file must be specified" if @workflowdoc.nil?
Expand Down
8 changes: 7 additions & 1 deletion lib/workflowmgr/slurmbatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,17 @@ def submit(task)
WorkflowMgr.stderr("Submitting #{task.attributes[:name]} using #{cmd} < #{tf.path} with input\n{{\n#{input}\n}}", 4)

# Run the submit command
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
end

# Parse the output of the submit command
if output=~/^Submitted batch job (\d+)/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
elsif output=~/Batch job submission failed: Socket timed out/

WorkflowMgr.stderr("WARNING: '#{output}', looking to see if job was submitted anyway...", 1)
Expand Down
8 changes: 7 additions & 1 deletion lib/workflowmgr/torquebatchsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,17 @@ def submit(task)
WorkflowMgr.stderr("Submitting #{task.attributes[:name]} using #{cmd} < #{tf.path} with input {{#{input}}}",4)

# Run the submit command
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
if WorkflowMgr::DRYRUN > 0
output="This is a dryrun"
else
output=`#{cmd} < #{tf.path} 2>&1`.chomp()
end

# Parse the output of the submit command
if output=~/^(\d+)(\.[a-zA-Z0-9-]+)*$/
return $1,output
elsif output=~/^This is a dryrun/
return $1,output
else
return nil,output
end
Expand Down
7 changes: 6 additions & 1 deletion lib/workflowmgr/workflowengine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,12 @@ def submit_new_jobs
uri=job.id
jobid,output=@bqServer.get_submit_status(job.task,job.cycle)
if output.nil?
@logServer.log(job.cycle,"Submission status of #{job.task} is pending at #{job.id}")
if WorkflowMgr::DRYRUN > 0
@dbServer.delete_jobs([job])
@logServer.log(job.cycle,"Submission of #{job.task} was a dryrun!")
else
@logServer.log(job.cycle,"Submission status of #{job.task} is pending at #{job.id}")
end
else
if jobid.nil?
# Delete the job from the database since it failed to submit. It will be retried next time around.
Expand Down
10 changes: 10 additions & 0 deletions lib/workflowmgr/workflowoption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class WorkflowOption
attr_reader :database
attr_reader :workflowdoc
attr_reader :verbose
attr_reader :dryrun

##########################################
#
Expand All @@ -27,6 +28,7 @@ def initialize(args)
@database=nil
@workflowdoc=nil
@verbose=1
@dryrun=0
@more_args=parse(args)

end # initialize
Expand Down Expand Up @@ -74,6 +76,11 @@ def add_opts(opts)
end
end

# Handle option for dryrun
opts.on("-n","--dryrun","Show Workflow Manager commands, but do not execute") do |dryrun|
@dryrun=1
end

# Handle option for version
opts.on("--version","Show Rocoto version") do
puts "Rocoto Version #{WorkflowMgr.version}"
Expand Down Expand Up @@ -127,6 +134,9 @@ def parse(args)
# Set verbosity level
WorkflowMgr.const_set("VERBOSE",@verbose)

# Set dryrun level
WorkflowMgr.const_set("DRYRUN",@dryrun)

# Set workflow id
WorkflowMgr.const_set("WORKFLOW_ID",File.basename(@workflowdoc))

Expand Down
2 changes: 1 addition & 1 deletion lib/workflowmgr/workflowsubsetoptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def add_opts(opts)
super(opts)

# Override the command usage text
opts.banner = "Usage: #{@name} [-h] [-v #] -d database_file -w workflow_document [-c cycle_list] [-t task_list] [-m metatask_list] [-a]"
opts.banner = "Usage: #{@name} [-h] [-v #] -d database_file -w workflow_document [-c cycle_list] [-t task_list] [-m metatask_list] [-a] [-n]"

# Cycles of interest
# C C,C,C C:C :C C:
Expand Down