Sha256: df45707822d915c52e0f3b50afddd51e54af2fe9e00ca80ae70926a197810c2d

Contents?: true

Size: 1.93 KB

Versions: 171

Compression:

Stored size: 1.93 KB

Contents

require 'rbbt/workflow/remote_workflow/driver/rest'
require 'rbbt/workflow/remote_workflow/driver/ssh'

class RemoteWorkflow
  def self.fix_hash(hash, fix_values = false)
    fixed = {}
    hash.each do |key, value|
      fixed[key.to_sym] = case value
                          when TrueClass
                            value
                          when FalseClass
                            value
                          when Hash 
                            fix_hash(value)  
                          when (fix_values and String )
                            value.to_sym
                          when IO
                            value.read
                          when TSV::Dumper
                            value.stream
                          when Step
                            stream = get_stream(value)
                            stream || value.load
                          else
                            value
                          end
    end
    fixed
  end

  def self.parse_exception(text)
    klass, message = text.split " => "
    begin
      klass = Kernel.const_get klass
      return klass.new message
    rescue
      message
    end
  end

  def self.capture_exception
    begin
      yield
    rescue Exception => e
      raise e unless e.respond_to? :response
      begin
        ne = parse_exception e.response.to_s
        case ne
        when String
          raise e.class, ne
        when Exception
          raise ne
        else
          raise
        end
      rescue
        raise e
      end
      raise $!
    end
  end

  def self.fix_params(params)
    new_params = {}
    params.each do |k,v|
      if Array === v and v.empty?
        new_params[k] = "EMPTY_ARRAY"
      else
        new_params[k] = v
      end
    end
    new_params
  end

  def exported_tasks
    @asynchronous_exports + @synchronous_exports + @exec_exports
  end

  def load_tasks
    exported_tasks.each{|name| tasks[name]}
  end

end

Version data entries

171 entries across 171 versions & 1 rubygems

Version Path
rbbt-util-5.43.0 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.42.0 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.41.1 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.41.0 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.40.5 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.40.4 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.40.3 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.40.0 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.39.0 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.38.1 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.38.0 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.16 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.15 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.14 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.13 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.12 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.11 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.10 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.9 lib/rbbt/workflow/remote_workflow/driver.rb
rbbt-util-5.37.8 lib/rbbt/workflow/remote_workflow/driver.rb