Class: WorkflowRemoteClient

Inherits:
Object
  • Object
show all
Includes:
Workflow
Defined in:
lib/rbbt/workflow/remote/client.rb,
lib/rbbt/workflow/remote/remote_step.rb

Defined Under Namespace

Classes: RemoteStep

Constant Summary

Constants included from Workflow

Workflow::DEBUG_JOB_HASH, Workflow::DEFAULT_NAME, Workflow::FORGET_DEP_TASKS, Workflow::LOAD_STEP_CACHE, Workflow::STEP_CACHE, Workflow::TAG

Instance Attribute Summary collapse

Attributes included from Workflow

#description, #documentation, #example_dir, #helpers, #last_task, #libdir, #load_step_cache, #remote_tasks, #step_cache, #task_dependencies, #task_description, #tasks, #workdir

Instance Method Summary collapse

Methods included from Workflow

#SOPT_str, #__job, __load_step, #_job, _load_step, #add_remote_tasks, #all_exports, #assign_dep_inputs, #dep, #dep_task, #desc, #doc, doc_parse_chunks, doc_parse_first_line, doc_parse_up_to, #documentation_markdown, #example, #example_inputs, #example_step, #examples, #export_asynchronous, #export_exec, #export_stream, #export_synchronous, extended, #extension, #fast_load_id, fast_load_step, #get_SOPT, get_SOPT, #get_job_step, #helper, #id_for, #import, #import_task, init_remote_tasks, installed_workflows, #jobs, #load_documentation, load_inputs, #load_name, load_remote_tasks, load_step, #load_step, load_step_cache, load_workflow_file, load_workflow_libdir, #local_persist_setup, #local_workdir_setup, local_workflow_filename, #log, #make_local, #nextflow, #nextflow_dir, #nextflow_file, #override_dependencies, parse_workflow_doc, process_remote_tasks, #real_dependencies, #rec_dependencies, #rec_input_defaults, #rec_input_descriptions, #rec_input_options, #rec_input_types, #rec_input_use, #rec_inputs, relocate, relocate_array, relocate_dependency, require_local_workflow, require_remote_workflow, require_workflow, resolve_locals, #returns, #set_step_dependencies, #setup_override_dependency, #step_module, #step_path, #task, #task_exports, #task_for, #task_from_dep, #task_info, transplant, #unexport, #with_workdir, workdir, workdir=, workflow_for

Methods included from InputModule

#input

Constructor Details

#initialize(url, name) ⇒ WorkflowRemoteClient

Returns a new instance of WorkflowRemoteClient.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rbbt/workflow/remote/client.rb', line 19

def initialize(url, name)
  Log.debug{ "Loading remote workflow #{ name }: #{ url }" }
  @url, @name = url, name

  rest = url.include?('ssh://') ? false : true

  if rest
    self.extend WorkflowRESTClient
  else
    self.extend WorkflowSSHClient
  end
  init_remote_tasks
end

Instance Attribute Details

#asynchronous_exportsObject

Returns the value of attribute asynchronous_exports.



17
18
19
# File 'lib/rbbt/workflow/remote/client.rb', line 17

def asynchronous_exports
  @asynchronous_exports
end

#exec_exportsObject

Returns the value of attribute exec_exports.



17
18
19
# File 'lib/rbbt/workflow/remote/client.rb', line 17

def exec_exports
  @exec_exports
end

#nameObject

Returns the value of attribute name.



17
18
19
# File 'lib/rbbt/workflow/remote/client.rb', line 17

def name
  @name
end

#stream_exportsObject

Returns the value of attribute stream_exports.



17
18
19
# File 'lib/rbbt/workflow/remote/client.rb', line 17

def stream_exports
  @stream_exports
end

#synchronous_exportsObject

Returns the value of attribute synchronous_exports.



17
18
19
# File 'lib/rbbt/workflow/remote/client.rb', line 17

def synchronous_exports
  @synchronous_exports
end

#urlObject

Returns the value of attribute url.



17
18
19
# File 'lib/rbbt/workflow/remote/client.rb', line 17

def url
  @url
end

Instance Method Details

#job(task, name, inputs) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rbbt/workflow/remote/client.rb', line 37

def job(task, name, inputs)
  task_info = task_info(task)
  fixed_inputs = {}
  input_types = IndiferentHash.setup(task_info[:input_types])

  inputs.each do |k,v| 
    k = k.to_sym
    if TSV === v
      fixed_inputs[k] = v.to_s
    else
      next if input_types[k].nil?
      case input_types[k].to_sym
      when :tsv, :array, :file, :text
        fixed_inputs[k] = (String === v and Open.exists?(v)) ? Open.open(v) : v
      else
        fixed_inputs[k] = v
      end
    end
  end

  stream_input = @can_stream ? task_info(task)[:input_options].select{|k,o| o[:stream] }.collect{|k,o| k }.first : nil
  RemoteStep.new(url, task, name, fixed_inputs, task_info[:result_type], task_info[:result_description], @exec_exports.include?(task), @stream_exports.include?(task), stream_input)
end

#load_id(id) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/rbbt/workflow/remote/client.rb', line 61

def load_id(id)
  task, name = id.split("/")
  step = RemoteStep.new url, task, nil
  step.name = name
  step.result_type = task_info(task)[:result_type]
  step.result_description = task_info(task)[:result_description]
  step
end

#to_sObject



33
34
35
# File 'lib/rbbt/workflow/remote/client.rb', line 33

def to_s
  name
end