def resubmit
set_q
@priority = @options['priority']
debug{ "priority <#{ @priority }>" }
@tag = @options['tag']
debug{ "tag <#{ @tag }>" }
@runner = @options['runner']
debug{ "runner <#{ @runner }>" }
@restartable = @options['restartable']
debug{ "restartable <#{ @restartable }>" }
@infile = @options['infile']
debug{ "infile <#{ @infile }>" }
jobs = []
if @infile
open(@infile) do |f|
debug{ "reading jobs from <#{ @infile }>" }
loadio f, @infile, jobs
end
end
if not STDIN.tty?
debug{ "reading jobs from <stdin>" }
loadio STDIN, 'stdin', jobs
end
jobs.each{|job| @argv << Integer(job['jid'])}
raise "no jobs specified!" if @argv.empty?
puts '---'
@q.transaction do
jobs = @q.list(*@argv)
jobs.each do |job|
job['priority'] = @priority if @priority
job['tag'] = @tag if @tag
job['runner'] = @runner if @runner
job['restartable'] = @restartable if @restartable
unless job['state'] =~ %/running/io
resubmitted = nil
@q.resubmit(job){|resubmitted|}
puts '-'
resubmitted.fields.each{|f| puts " #{ f }: #{ resubmitted[f] }" }
end
end
end
if false
@q.transaction do
@q.ro_transaction do
@q.transaction do
puts 42
end
end
end
@q.submit(tuple)
@q.delete(Integer(tuple['jid']))
jobs.each do |job|
job['priority'] = @priority if @priority
job['tag'] = @tag if @tag
job['runner'] = @runner if @runner
job['restartable'] = @restartable if @restartable
end
if @options['quiet']
@q.submit(*jobs)
else
puts '---'
@q.submit(*jobs) do |tuple|
puts '-'
tuple.fields.each{|f| puts " #{ f }: #{ tuple[ f ] }"}
end
end
end
jobs = nil
self
end