Class: Textus::Action::Drain
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/action/drain.rb
Instance Method Summary collapse
- #call(container:, call:) ⇒ Object
-
#initialize(prefix: nil, lane: nil) ⇒ Drain
constructor
A new instance of Drain.
Methods included from Contract::DSL
arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view
Methods inherited from Base
Constructor Details
#initialize(prefix: nil, lane: nil) ⇒ Drain
Returns a new instance of Drain.
15 16 17 18 19 |
# File 'lib/textus/action/drain.rb', line 15 def initialize(prefix: nil, lane: nil) super() @prefix = prefix @lane = lane end |
Instance Method Details
#call(container:, call:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/textus/action/drain.rb', line 21 def call(container:, call:) queue = Textus::Ports::JobStore.new(root: container.root) Textus::Jobs::Planner.seed( container: container, queue: queue, role: call.role, ) queue.reclaim(now: Textus::Ports::Clock.new.now) summary = Textus::Jobs::Worker.for(container:, queue:).drain { "protocol" => Textus::PROTOCOL, "ok" => summary.failed.zero?, "completed" => summary.completed, "failed" => summary.failed, } end |