Sha256: f4425a1bf205eeab37b53f12b0ceab57219f1c0f57b49a8481e629fc8da497b9

Contents?: true

Size: 1.84 KB

Versions: 172

Compression:

Stored size: 1.84 KB

Contents

class WorkflowRESTClient

  def workflow_description
    WorkflowRESTClient.get_raw(File.join(url, 'description'))
  end

  def documentation
    @documention ||= IndiferentHash.setup(WorkflowRESTClient.get_json(File.join(url, "documentation"),{}))
  end

  def task_info(task)
    @task_info ||= {}
    @task_info[task]
    
    if @task_info[task].nil?
      task_info = WorkflowRESTClient.get_json(File.join(url, task.to_s, 'info'))
      task_info = WorkflowRESTClient.fix_hash(task_info)

      task_info[:result_type] = task_info[:result_type].to_sym
      task_info[:export] = task_info[:export].to_sym
      task_info[:input_types] = WorkflowRESTClient.fix_hash(task_info[:input_types], true)
      task_info[:inputs] = task_info[:inputs].collect{|input| input.to_sym }

      @task_info[task] = task_info
    end
    @task_info[task]
  end

  def exported_tasks
    (@asynchronous_exports  + @synchronous_exports + @exec_exports).compact.flatten
  end

  def tasks
    @tasks ||= Hash.new do |hash,task_name| 
      info = task_info(task_name)
      task = Task.setup info do |*args|
        raise "This is a remote task" 
      end
      task.name = task_name.to_sym
      hash[task_name] = task
    end
  end

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

  def task_dependencies
    @task_dependencies ||= Hash.new do |hash,task| 
      hash[task] = if exported_tasks.include? task
        WorkflowRESTClient.get_json(File.join(url, task.to_s, 'dependencies'))
      else
        []
      end
    end
  end

  def init_remote_tasks
    task_exports = WorkflowRESTClient.get_json(url)
    @asynchronous_exports = task_exports["asynchronous"].collect{|task| task.to_sym }
    @synchronous_exports = task_exports["synchronous"].collect{|task| task.to_sym }
    @exec_exports = task_exports["exec"].collect{|task| task.to_sym }
    nil
  end
end

Version data entries

172 entries across 172 versions & 2 rubygems

Version Path
rbbt-util-5.19.36 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.35 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.34 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.32 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.31 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.30 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.29 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.28 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.27 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.26 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.25 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.24 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.23 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.22 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.21 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.20 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.19 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.18 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.17 lib/rbbt/rest/client/adaptor.rb
rbbt-util-5.19.16 lib/rbbt/rest/client/adaptor.rb