Should the daemon ignore regular maintenance steps?
# File lib/miga/daemon/base.rb, line 68 def bypass_maintenance? !!runopts(:bypass_maintenance) end
Returns Integer indicating the number of seconds to sleep between checks
# File lib/miga/daemon/base.rb, line 37 def latency runopts(:latency) end
Writing file handler (IO) to the log file
# File lib/miga/daemon/base.rb, line 85 def logfh @logfh ||= nil return $stderr if show_log? return @logfh if @logfh && !@logfh.closed? @logfh = File.open(output_file, 'w') end
Returns Integer indicating the maximum number of concurrent jobs to run
# File lib/miga/daemon/base.rb, line 43 def maxjobs runopts(:maxjobs) end
Returns the path to the list of execution hostnames
# File lib/miga/daemon/base.rb, line 49 def nodelist runopts(:nodelist) end
Returns Integer indicating the number of CPUs per job
# File lib/miga/daemon/base.rb, line 55 def ppn runopts(:ppn) end
Set/get options, where k
is the Symbol of the option and
v
is the value (or nil to use as getter). Skips consistency
tests if force
. Returns new value.
# File lib/miga/daemon/base.rb, line 11 def runopts(k, v = nil, force = false) k = k.to_sym unless v.nil? case k when :latency, :maxjobs, :ppn, :format_version, :verbosity v = v.to_i if !force && v == 0 && k != :verbosity raise "Daemon's #{k} cannot be set to zero" end when :shutdown_when_done, :show_log, :bypass_maintenance v = !!v when :nodelist if v =~ /^\$/ vv = ENV[v.sub('$', '')] or raise "Unset environment variable: #{v}" v = vv end say "Reading node list: #{v}" v = File.readlines(v).map(&:chomp) end @runopts[k] = v end @runopts[k] end
Display log instead of the progress summary
# File lib/miga/daemon/base.rb, line 95 def show_log! @runopts[:show_log] = true end
Display log instead of the progress summary?
# File lib/miga/daemon/base.rb, line 107 def show_log? @runopts[:show_log] ||= false end
Display progress summary instead of the log
# File lib/miga/daemon/base.rb, line 101 def show_summary! @runopts[:show_log] = false end
Returns Boolean indicating if the daemon should shutdown when processing is complete
# File lib/miga/daemon/base.rb, line 62 def shutdown_when_done? !!runopts(:shutdown_when_done) end
Returns the level of verbosity for the daemon as an Integer, or 1 if unset. Verbosity levels are: 0: No output 1: General daemon and job information 2: Same, and indicate when each task is performed (even if nothing happens) 3: Same, and indicate when each loop begins and ends
# File lib/miga/daemon/base.rb, line 79 def verbosity runopts(:verbosity) || 1 end