Class: RQ::Snapshotter
- Inherits:
-
MainHelper
- Object
- MainHelper
- RQ::Snapshotter
- Defined in:
- lib/rq/snapshotter.rb
Overview
a Snapshotter is responsible for safely making a hot snapshot of a queue’s db. it’s very useful to make a snapshot if, for instance, you are working out a complex query over several attempts since each attempt will compete with other processes for the queue’s lock. by making a snapshot you will have your own read only copy to perfect your command before applying it to the actual queue. the feature can also be used to make a hot backup of a queue - tough the Backer has some features that make this more convenient
Constant Summary
Constants included from Logging
Logging::DIV0, Logging::DIV1, Logging::DIV2, Logging::DIV3, Logging::EOL, Logging::SEC0, Logging::SEC1, Logging::SEC2, Logging::SEC3
Instance Attribute Summary
Attributes inherited from MainHelper
#argv, #cmd, #dot_rq_dir, #env, #fields, #job_stdin, #loops, #main, #mode, #options, #program, #q, #qpath, #quiet, #stdin
Instance Method Summary collapse
-
#snapshot ⇒ Object
–{{{.
Methods inherited from MainHelper
#dumping_yaml_tuples, #field_match, #init_job_stdin!, #initialize, #loadio, #loadyaml, #set_q
Methods included from Logging
Methods included from Logging::LogMethods
#debug, #error, #fatal, #info, #logerr, #logger, #logger=, #warn
Methods included from Util
#alive?, append_features, #btrace, #columnize, #defval, #emsg, #erreq, #errmsg, #escape, #escape!, #exec, export, #fork, #getopt, #hashify, #hms, #host, #hostname, #klass, #maim, #mcp, #realpath, #stamptime, #system, #timestamp, #tmpnam, #uncache, #which_ruby
Constructor Details
This class inherits a constructor from RQ::MainHelper
Instance Method Details
#snapshot ⇒ Object
–{{{
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rq/snapshotter.rb', line 20 def snapshot #--{{{ set_q qtmp = @argv.shift raise "<#{ qtmp }> exists" if qtmp and test(?e, qtmp) qss = @q.snapshot qtmp, @options['retries'] #info{ "created q snapshot <#{ qtmp }>" } puts '---' puts "q: #{ qss.path }" puts "db: #{ qss.db.path }" puts "schema: #{ qss.db.schema }" puts "lock: #{ qss.db.lockfile }" #--}}} end |