RQ::MainHelper (Class)

In: lib/rq-2.0.0/mainhelper.rb
Parent: Object
MainHelper StatusLister Snapshotter Feeder Deleter Relayer Executor Submitter Locker Backer Configurator Lister Rotater Creator Updater Querier ::Hash ConfigFile DRbUndumped JobRunner Main QDB JobQueue JobRunnerDaemon Array SleepCycle Job ArrayFields ::OrderedHash OrderedAutoHash LogMethods Refresher lib/rq-2.0.0/updater.rb lib/rq-2.0.0/lister.rb lib/rq-2.0.0/submitter.rb lib/rq-2.0.0/refresher.rb lib/rq-2.0.0/snapshotter.rb lib/rq-2.0.0/jobrunnerdaemon.rb lib/rq-2.0.0/configfile.rb lib/rq-2.0.0/querier.rb lib/rq-2.0.0/mainhelper.rb lib/rq-2.0.0/creator.rb lib/rq-2.0.0/feeder.rb lib/rq-2.0.0/qdb.rb bin/rq.rb lib/rq-2.0.0/configurator.rb lib/rq-2.0.0/jobqueue.rb lib/rq-2.0.0/backer.rb lib/rq-2.0.0/sleepcycle.rb lib/rq-2.0.0/jobrunner.rb lib/rq-2.0.0/executor.rb lib/rq-2.0.0/relayer.rb lib/rq-2.0.0/job.rb lib/rq-2.0.0/rotater.rb lib/rq-2.0.0/statuslister.rb lib/rq-2.0.0/locker.rb lib/rq-2.0.0/deleter.rb lib/rq-2.0.0/orderedautohash.rb Usage Util LogClassMethods LoggerExt LogMethods Logging RQ Module: RQ

the MainHelper class abstracts some of the common functions the various Main delegates require

Methods

new   set_q  

Attributes

argv  [R] 
cmd  [R] 
env  [R] 
main  [R] 
mode  [R] 
options  [R] 
q  [R] 
qpath  [R] 

Included Modules

Util Logging

Public Class methods

[Source]

    # File lib/rq-2.0.0/mainhelper.rb, line 26
26:       def initialize main
27: #--{{{
28:         @main = main
29:         @logger = main.logger
30:         @argv = main.argv
31:         @env = main.env
32:         @cmd = main.cmd
33:         @options = main.options
34:         @qpath = main.qpath
35:         @mode = main.mode
36:         @q = nil 
37: #--}}}
38:       end

Public Instance methods

[Source]

    # File lib/rq-2.0.0/mainhelper.rb, line 39
39:       def set_q
40: #--{{{
41:         raise "q <#{ @qpath }> does not exist" unless test ?d, @qpath
42:         @q = JobQueue::new @qpath, 'logger' => @logger
43:         if @options['snapshot']
44:           ss = "#{ $0 }_#{ Process::pid }_#{ Thread::current.id.abs }_#{ rand Time::now.to_i  }".gsub(%|/|o,'_')
45:           qtmp = File::join Dir::tmpdir, ss
46:           @q = @q.snapshot qtmp, @options['retries']
47:           at_exit{ FileUtils::rm_rf qtmp }
48:         end
49: #--}}}
50:       end

[Validate]