class DTK::Client::Operation::Service::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/client/operation/service/task_status/stream_mode/element/stage.rb, line 31
def self.get_and_render_stages(task_status_handle, opts = {})
  unless wait = opts[:wait]
    raise Error, "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)
    # Can there be more than 1 element in elements array?
    if elements.first.current_status
      cursor.advance!(true)
    else
      cursor.advance!(task_end?(elements))
    end
  end
end
get_single_stage(task_status_handle, stage_num, opts = {}) click to toggle source
# File lib/client/operation/service/task_status/stream_mode/element/stage.rb, line 74
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/client/operation/service/task_status/stream_mode/element/stage.rb, line 78
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/client/operation/service/task_status/stream_mode/element/stage.rb, line 24
def initialize(response_element, opts = {})
  super
  @just_render = opts[:just_render]
end