Sha256: ba3d23548d8e1d9c10cfa25b10d748af29b4fd7043b3d95b30f55a11d34b9698

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')

require 'trollop'
require "rjobs/jobs_file"
require "rjobs/job_input_file"
require "rjobs/job"
require "rjobs/job_handler"
require 'rjobs/cli_helper'
include  Rjobs::CliHelper   

p = Trollop::Parser.new do
  banner <<-EOS
Submit jobs described in the YAML input file.

Usage:
      rjsubmit [options] <filename>
where [options] are:
EOS
  
end

opts = Trollop::with_standard_exception_handling p do
  o = p.parse ARGV
  raise Trollop::HelpNeeded if ARGV.empty? # show help screen
end


jobs_input_file = ARGV[0]

jif = Rjobs::JobInputFile.new(jobs_input_file)
jobs = []
length = jif.jobIdTo.length
(jif.jobIdFrom .. jif.jobIdTo).each do |id| 
  j = Rjobs::Job.new()
  j.name = "%s%0#{length}d" % [jif.jobName,id]
  j.command = jif.command
  jobs << j        
end

jobs.each do |job|        
  Rjobs::JobHandler.submit_job(job)        
end

jf = Rjobs::JobsFile.new()
jf.write(jif.jobName+".rjobs",jobs)

puts "#{jobs.count} job(s) submited.".green

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rjobs-0.2.0.alpha bin/rjsubmit
rjobs-0.1.0.alpha bin/rjsubmit