Class: DTK::Client::TaskStatus::StreamMode::Element::Stage
- Inherits:
-
DTK::Client::TaskStatus::StreamMode::Element
- Object
- DTK::Client::TaskStatus::StreamMode::Element
- DTK::Client::TaskStatus::StreamMode::Element::Stage
- Includes:
- Render::Mixin
- Defined in:
- lib/task_status/stream_mode/element/stage/render.rb,
lib/task_status/stream_mode/element/stage.rb
Overview
Copyright © 2010-2016 dtk contributors
This file is part of the dtk project.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Defined Under Namespace
Modules: Render Classes: Cursor
Class Method Summary collapse
-
.get_and_render_stages(task_status_handle, opts = {}) ⇒ Object
opts has :wait - amount to wait if get no results (required).
- .get_single_stage(task_status_handle, stage_num, opts = {}) ⇒ Object
- .get_stages(task_status_handle, start_stage_num, end_stage_num, opts = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(response_element, opts = {}) ⇒ Stage
constructor
A new instance of Stage.
Methods included from Render::Mixin
Methods inherited from DTK::Client::TaskStatus::StreamMode::Element
Methods included from RenderMixin
#formatted_duration?, #render_border, #render_duration_line, #render_empty_line, #render_empty_lines, #render_line, #render_start_time
Constructor Details
#initialize(response_element, opts = {}) ⇒ Stage
Returns a new instance of Stage.
24 25 26 27 |
# File 'lib/task_status/stream_mode/element/stage.rb', line 24 def initialize(response_element, opts = {}) super @just_render = opts[:just_render] end |
Class Method Details
.get_and_render_stages(task_status_handle, opts = {}) ⇒ Object
opts has
:wait - amount to wait if get no results (required)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/task_status/stream_mode/element/stage.rb', line 31 def self.get_and_render_stages(task_status_handle, opts = {}) unless wait = opts[:wait] raise DtkError::Client, "opts[:wait] must be set" end cursor = Cursor.new until cursor.task_end? do elements = get_single_stage(task_status_handle, cursor.stage, {:wait_for => cursor.wait_for}.merge(opts)) if no_results_yet?(elements) sleep wait next end render_elements(elements) cursor.advance!(task_end?(elements)) end end |
.get_single_stage(task_status_handle, stage_num, opts = {}) ⇒ Object
70 71 72 |
# File 'lib/task_status/stream_mode/element/stage.rb', line 70 def self.get_single_stage(task_status_handle, stage_num, opts = {}) get_stages(task_status_handle, stage_num, stage_num, opts) end |
.get_stages(task_status_handle, start_stage_num, end_stage_num, opts = {}) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/task_status/stream_mode/element/stage.rb', line 74 def self.get_stages(task_status_handle, start_stage_num, end_stage_num, opts = {}) opts_get = { :start_index => start_stage_num, :end_index => end_stage_num }.merge(opts) get_task_status_elements(task_status_handle, :stage, opts_get) end |