Class: WorkflowRESTClient::RemoteStep
- Inherits:
-
Step
- Object
- Step
- WorkflowRESTClient::RemoteStep
- Defined in:
- lib/rbbt/rest/client.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#result_description ⇒ Object
Returns the value of attribute result_description.
-
#result_type ⇒ Object
Returns the value of attribute result_type.
-
#task ⇒ Object
Returns the value of attribute task.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #_exec(noload = false) ⇒ Object
- #clean ⇒ Object
- #done? ⇒ Boolean
- #exec ⇒ Object
- #file(file) ⇒ Object
- #files ⇒ Object
- #fork ⇒ Object
- #info ⇒ Object
-
#initialize(base_url, task = nil, name = nil, inputs = nil, result_type = nil, result_description = nil, exec = false) ⇒ RemoteStep
constructor
A new instance of RemoteStep.
- #join ⇒ Object
- #load ⇒ Object
- #run(noload = false) ⇒ Object
- #status ⇒ Object
- #task_name ⇒ Object
Constructor Details
#initialize(base_url, task = nil, name = nil, inputs = nil, result_type = nil, result_description = nil, exec = false) ⇒ RemoteStep
Returns a new instance of RemoteStep.
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/rbbt/rest/client.rb', line 96 def initialize(base_url, task = nil, name = nil, inputs = nil, result_type = nil, result_description = nil, exec = false) if task.nil? @url = base_url else @base_url, @task, @name, @inputs, @result_type, @result_description = base_url, task, name, inputs, result_type, result_description if exec @url = [File.join(base_url, task.to_s), inputs] else self.fork end end end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def base_url @base_url end |
#inputs ⇒ Object
Returns the value of attribute inputs.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def inputs @inputs end |
#name ⇒ Object
Returns the value of attribute name.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def name @name end |
#result_description ⇒ Object
Returns the value of attribute result_description.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def result_description @result_description end |
#result_type ⇒ Object
Returns the value of attribute result_type.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def result_type @result_type end |
#task ⇒ Object
Returns the value of attribute task.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def task @task end |
#url ⇒ Object
Returns the value of attribute url.
69 70 71 |
# File 'lib/rbbt/rest/client.rb', line 69 def url @url end |
Instance Method Details
#_exec(noload = false) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/rbbt/rest/client.rb', line 109 def _exec(noload = false) if Array === @url url, params = @url else url, params = @url, {:_cache_type => :synchronous} end params[:jobname] = @name if @name if noload and %w(boolean string tsv).include? result_type WorkflowRESTClient.get_raw(url, params) else case result_type when :string WorkflowRESTClient.get_raw(url, params) when :boolean WorkflowRESTClient.get_raw(url, params) == "true" when :tsv TSV.open(StringIO.new(WorkflowRESTClient.get_raw(url, params))) when :annotations Annotated.load_tsv(TSV.open(StringIO.new(WorkflowRESTClient.get_raw(url, params)))) else WorkflowRESTClient.get_json(url, params) end end end |
#clean ⇒ Object
162 163 164 165 |
# File 'lib/rbbt/rest/client.rb', line 162 def clean WorkflowRESTClient.get_raw(url, :_update => :clean) self end |
#done? ⇒ Boolean
86 87 88 |
# File 'lib/rbbt/rest/client.rb', line 86 def done? status.to_s == 'done' end |
#exec ⇒ Object
136 137 138 139 |
# File 'lib/rbbt/rest/client.rb', line 136 def exec res = _exec prepare_result(res, result_type) end |
#file(file) ⇒ Object
171 172 173 |
# File 'lib/rbbt/rest/client.rb', line 171 def file(file) WorkflowRESTClient.get_json(File.join(url, 'file', file)) end |
#files ⇒ Object
167 168 169 |
# File 'lib/rbbt/rest/client.rb', line 167 def files WorkflowRESTClient.get_json(File.join(url, 'files')) end |
#fork ⇒ Object
90 91 92 93 94 |
# File 'lib/rbbt/rest/client.rb', line 90 def fork @name = WorkflowRESTClient.post_jobname(File.join(base_url, task.to_s), inputs.merge(:jobname => @name, :_cache_type => :asynchronous)) @url = File.join(base_url, task.to_s, @name) self end |
#info ⇒ Object
79 80 81 82 83 84 |
# File 'lib/rbbt/rest/client.rb', line 79 def info info = WorkflowRESTClient.get_json(File.join(url, 'info')) info = WorkflowRESTClient.fix_hash(info) info[:status] = info[:status].to_sym if String === info[:status] info end |
#join ⇒ Object
153 154 155 156 |
# File 'lib/rbbt/rest/client.rb', line 153 def join exec self end |
#load ⇒ Object
149 150 151 |
# File 'lib/rbbt/rest/client.rb', line 149 def load exec end |
#run(noload = false) ⇒ Object
141 142 143 144 145 146 147 |
# File 'lib/rbbt/rest/client.rb', line 141 def run(noload = false) if noload _exec(noload) else exec end end |
#status ⇒ Object
158 159 160 |
# File 'lib/rbbt/rest/client.rb', line 158 def status info[:status] end |
#task_name ⇒ Object
75 76 77 |
# File 'lib/rbbt/rest/client.rb', line 75 def task_name (Array === @url ? @url.first : @url).split("/")[-2] end |