class DTK::Client::TaskStatus::StreamMode::Element::Stage
Copyright (C) 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.
Public Class Methods
get_and_render_stages(task_status_handle, opts = {})
click to toggle source
opts has
:wait - amount to wait if get no results (required)
# 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 = {})
click to toggle source
# 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 = {})
click to toggle source
# 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
new(response_element, opts = {})
click to toggle source
Calls superclass method
# File lib/task_status/stream_mode/element/stage.rb, line 24 def initialize(response_element, opts = {}) super @just_render = opts[:just_render] end