it's all in the details
This commit is contained in:
parent
84776cb511
commit
3088d578f5
1 changed files with 19 additions and 17 deletions
36
pbatch/pb.rb
36
pbatch/pb.rb
|
|
@ -39,20 +39,22 @@ ENDTXT
|
||||||
end
|
end
|
||||||
|
|
||||||
def readconfig
|
def readconfig
|
||||||
File.open("#{@basedir}/#{CONFIG}").each_line {|line|
|
if FileTest.exists?("#{@basedir}/#{CONFIG}")
|
||||||
line.sub!(/#.*/, "")
|
File.open("#{@basedir}/#{CONFIG}").each_line {|line|
|
||||||
line.sub!(/^\s*/, "")
|
line.sub!(/#.*/, "")
|
||||||
line.sub!(/\s*$/, "")
|
line.sub!(/^\s*/, "")
|
||||||
if line.match(/^$/)
|
line.sub!(/\s*$/, "")
|
||||||
next
|
if line.match(/^$/)
|
||||||
end
|
next
|
||||||
line.match(/([^=]*?)\s*=\s*(.*)/)
|
end
|
||||||
case $1
|
line.match(/([^=]*?)\s*=\s*(.*)/)
|
||||||
when "maxproc" then @config["maxproc"] = $2
|
case $1
|
||||||
when "waittime" then @config["waittime"] = $2
|
when "maxproc" then @config["maxproc"] = $2
|
||||||
else puts "unknown option #{$1}"
|
when "waittime" then @config["waittime"] = $2
|
||||||
end
|
else puts "unknown option #{$1}"
|
||||||
}
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def status
|
def status
|
||||||
|
|
@ -111,7 +113,7 @@ def addjob
|
||||||
puts "Job #{jobnumber} already scheduled. This should not happen."
|
puts "Job #{jobnumber} already scheduled. This should not happen."
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
File.open("#{@basedir}/#{JOBSDIR}/#{jobnumber}"){|file|
|
File.open("#{@basedir}/#{JOBSDIR}/#{jobnumber}", "w"){|file|
|
||||||
file.puts ARGV.join(" ")
|
file.puts ARGV.join(" ")
|
||||||
}
|
}
|
||||||
File.chmod(RUNMODE, "#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
File.chmod(RUNMODE, "#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||||
|
|
@ -136,7 +138,7 @@ end
|
||||||
|
|
||||||
def createconfig
|
def createconfig
|
||||||
if ! FileTest.exists?("#{@basedir}/#{CONFIG}")
|
if ! FileTest.exists?("#{@basedir}/#{CONFIG}")
|
||||||
File.new("#{@basedir}/#{CONFIG}", "w"){|file|
|
File.open("#{@basedir}/#{CONFIG}", "w"){|file|
|
||||||
file.puts <<EOT
|
file.puts <<EOT
|
||||||
# how many parallel processes?
|
# how many parallel processes?
|
||||||
maxproc=3
|
maxproc=3
|
||||||
|
|
@ -149,7 +151,7 @@ end
|
||||||
|
|
||||||
def master
|
def master
|
||||||
# als ik threading ga gebruiken is deze dus niet nodig
|
# als ik threading ga gebruiken is deze dus niet nodig
|
||||||
File.new(RUNNINGFILE, "w").flock(File::LOCK_EX){|file|
|
File.open(RUNNINGFILE, "w").flock(File::LOCK_EX){|file|
|
||||||
file.puts "0"
|
file.puts "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue