Class: Wurk::Preflight::Verify
- Inherits:
-
Object
- Object
- Wurk::Preflight::Verify
- Defined in:
- lib/wurk/preflight/verify.rb
Overview
wurk verify: the post-cutover check. Read-only, unless canary: names a
job class to push to every subscribed queue. Run it again after a few
minutes rather than trusting one pass: lists of a just-stopped fleet and a
leader election are both normal in the first ~2 minutes.
Class Method Summary collapse
- .push_canaries(config, report, klass, owners) ⇒ Object
- .run(config, canary: nil, limit: Preflight::DEFAULT_LIMIT, pause: 0.005, progress: nil, now: ::Time.now) ⇒ Object
Instance Method Summary collapse
-
#initialize(reader, report, keyspace, owners, now) ⇒ Verify
constructor
A new instance of Verify.
- #run ⇒ Object
Constructor Details
#initialize(reader, report, keyspace, owners, now) ⇒ Verify
Returns a new instance of Verify.
39 40 41 42 43 44 45 |
# File 'lib/wurk/preflight/verify.rb', line 39 def initialize(reader, report, keyspace, owners, now) @reader = reader @report = report @keyspace = keyspace @owners = owners @now = now end |
Class Method Details
.push_canaries(config, report, klass, owners) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/wurk/preflight/verify.rb', line 30 def self.push_canaries(config, report, klass, owners) queues = owners.processes.flat_map(&:queues).uniq.sort client = Wurk::Client.new(config: config) jids = queues.to_h { |queue| [queue, client.push('class' => klass, 'queue' => queue, 'args' => [queue])] } report.section('canary', { 'class' => klass, 'pushed' => jids }) report.info('canary', "Pushed #{klass} to #{jids.size} queue(s). This says the push worked: confirm each ran " \ 'in your logs.') end |
.run(config, canary: nil, limit: Preflight::DEFAULT_LIMIT, pause: 0.005, progress: nil, now: ::Time.now) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wurk/preflight/verify.rb', line 18 def self.run(config, canary: nil, limit: Preflight::DEFAULT_LIMIT, pause: 0.005, progress: nil, now: ::Time.now) reader = Reader.new(config) report = Report.new('verify') keyspace = Keyspace.new(reader, limit: limit, pause: pause, progress: progress).walk report.target(reader, keyspace) new(reader, report, keyspace, Owners.new(reader), now).run push_canaries(config, report, canary, Owners.new(reader)) if canary report ensure reader&.close end |
Instance Method Details
#run ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/wurk/preflight/verify.rb', line 47 def run processes queues private_lists leader cron end |