Class: Bosh::Deployer::DeployerRenderer
- Inherits:
-
Cli::TaskTracking::EventLogRenderer
- Object
- Cli::TaskTracking::EventLogRenderer
- Bosh::Deployer::DeployerRenderer
- Defined in:
- lib/bosh/deployer/deployer_renderer.rb
Constant Summary collapse
- DEFAULT_POLL_INTERVAL =
1
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#stage ⇒ Object
Returns the value of attribute stage.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
- #enter_stage(stage, total) ⇒ Object
- #finish(state) ⇒ Object
- #interval_poll ⇒ Object
- #parse_event(event) ⇒ Object
- #start ⇒ Object
- #update(state, task) ⇒ Object
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 3 def index @index end |
#stage ⇒ Object
Returns the value of attribute stage.
3 4 5 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 3 def stage @stage end |
#total ⇒ Object
Returns the value of attribute total.
3 4 5 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 3 def total @total end |
Instance Method Details
#enter_stage(stage, total) ⇒ Object
25 26 27 28 29 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 25 def enter_stage(stage, total) @stage = stage @total = total @index = 0 end |
#finish(state) ⇒ Object
20 21 22 23 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 20 def finish(state) @thread.kill super(state) end |
#interval_poll ⇒ Object
7 8 9 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 7 def interval_poll Bosh::Cli::Config.poll_interval || DEFAULT_POLL_INTERVAL end |
#parse_event(event) ⇒ Object
31 32 33 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 31 def parse_event(event) event end |
#start ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 11 def start @thread = Thread.new do loop do refresh sleep(interval_poll) end end end |
#update(state, task) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 35 def update(state, task) event = { 'time' => Time.now, 'stage' => @stage, 'task' => task, 'tags' => [], 'index' => @index + 1, 'total' => @total, 'state' => state.to_s, 'progress' => state == :finished ? 100 : 0 } add_event(event) @index += 1 if state == :finished end |