Class: Condor::SubmitFile

Inherits:
Object
  • Object
show all
Defined in:
lib/condor.rb

Overview

The text of a file that can be sent to the condor_submit program.

Instance Method Summary collapse

Constructor Details

#initialize(executable, arguments, options = {}, output = nil, error = nil) ⇒ SubmitFile

Specify a single executable and a list of argument sets. Each element of argument_list is a set of arguments. One job will be queued up for each set of arguments.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/condor.rb', line 80

def initialize(executable, arguments, options = {},
               output = nil, error = nil)
  executable.strip!
  # Read default options from a system-wide configuratation file if one
  # exists.
  options = configuration_options.merge(options)
  # Create the header common to all the jobs.
  @submit = (options.keys.select do |attribute|
    not options[attribute].nil?
  end.collect do |attribute|
    "#{attribute} = #{options[attribute]}"
  end + ["executable = #{executable}"]).join("\n") + "\n"
  # Queue up the arguments for each individual job.
  output = current_dir_log_file(executable, "output") if output.nil?
  error = current_dir_log_file(executable, "error") if error.nil?
  arguments.each do |job_arguments|
    @submit += <<-EOTEXT

\targuments  = #{job_arguments.join(' ')}
\toutput     = #{output}
\terror      = #{error}
\tQueue
    EOTEXT
  end
end

Instance Method Details

#to_sObject

Return a string that can serve as a Condor submit file.



107
108
109
# File 'lib/condor.rb', line 107

def to_s
  @submit
end