RQ::Locker (Class)

In: lib/rq-2.3.1/locker.rb
Parent: MainHelper
MainHelper StatusLister Snapshotter ReSubmitter 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.3.1/rotater.rb lib/rq-2.3.1/sleepcycle.rb lib/rq-2.3.1/statuslister.rb lib/rq-2.3.1/updater.rb lib/rq-2.3.1/relayer.rb lib/rq-2.3.1/creator.rb lib/rq-2.3.1/lister.rb lib/rq-2.3.1/snapshotter.rb bin/rq.rb lib/rq-2.3.1/resubmitter.rb lib/rq-2.3.1/orderedautohash.rb lib/rq-2.3.1/locker.rb lib/rq-2.3.1/querier.rb lib/rq-2.3.1/submitter.rb lib/rq-2.3.1/configfile.rb lib/rq-2.3.1/executor.rb lib/rq-2.3.1/refresher.rb lib/rq-2.3.1/job.rb lib/rq-2.3.1/mainhelper.rb lib/rq-2.3.1/qdb.rb lib/rq-2.3.1/feeder.rb lib/rq-2.3.1/configurator.rb lib/rq-2.3.1/deleter.rb lib/rq-2.3.1/jobqueue.rb lib/rq-2.3.1/jobrunnerdaemon.rb lib/rq-2.3.1/backer.rb lib/rq-2.3.1/jobrunner.rb Usage Util LogClassMethods LoggerExt LogMethods Logging RQ Module: RQ

a Locker simply obtains an exclusive lock on a queue’s lock and then runs and arbitrary command which is taken from the command line only. it’s use is simply to allow unforseen applications to coordinate access to the queue

Methods

lock  

Public Instance methods

[Source]

    # File lib/rq-2.3.1/locker.rb, line 18
18:       def lock
19: #--{{{
20:         set_q
21:         ltype = @argv.shift
22:         debug{ "ltype <#{ ltype }>" }
23:         read_only =
24:           case ltype
25:             when /^\s*r(?:ead)?|^\s*sh(?:ared)?/io
26:               true
27:             when /^\s*w(?:rite)?|^\s*ex(?:clusive)?/io
28:               false
29:             else
30:               raise "lock type must be one of (r)ead|(sh)ared|(w)rite|(ex)clusive, not <#{ ltype }>"
31:           end
32:         cmd = @argv.join(' ').strip
33:         raise "no command given for lock type <#{ ltype }>" if cmd.empty?
34:         debug{ "cmd <#{ cmd }>" }
35:         @q.lock(:read_only => read_only){ Util::system cmd }
36: #--}}}
37:       end

[Validate]