rbbt-rest 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b556674b8552bf64d8680def41f2316821743b64
4
- data.tar.gz: 3f1fb6faa193e793870d65706e3ca828b7de897f
3
+ metadata.gz: 149f96d6cd3121af4c1948eb970b3ef15caa2ff9
4
+ data.tar.gz: c9c8e18ecbda7f195325212a64f5ae9ccbb1a631
5
5
  SHA512:
6
- metadata.gz: 8329fbef77bc84d70921839a9648e988a1d587a33de739c23dd1255e90bddbe33794a12dee8e51dc6e4bede70b7118690ea1afb5a1022ddc35dc995401303b4b
7
- data.tar.gz: 233769daa035553e3a1d294f2cf1cb426bbc779605b24e1c357a65d6d3693f831c9d72014d1cf845ebe00c6f0b770d31a68810e47daa384e613dfd164709993b
6
+ metadata.gz: 634d3acb1114b6baaeaf19d104465c5765ec6d075c08168181584c10b9688e7d076bda718e89a3ba4b75976f42edce43726637fe9378d4dca0e551730e6afc50
7
+ data.tar.gz: 5440ddd934f2a1ef148f7a2c0f2c95f81d2341f9d0cbdcd3a4cb0ddbe8501d54f33694bb4eee638711190e85be93c3a40522f70a8896c38412b2e9481c8f1147
@@ -18,6 +18,7 @@ class WorkflowRESTClient
18
18
  begin
19
19
  yield
20
20
  rescue Exception => e
21
+ raise $! unless e.respond_to? :response
21
22
  klass, message = e.response.split " => "
22
23
  begin
23
24
  klass = Kernel.const_get klass
@@ -1,27 +1,14 @@
1
1
  class WorkflowRESTClient
2
2
  class RemoteStep < Step
3
3
 
4
- attr_accessor :url, :base_url, :task, :base_name, :inputs, :result_type, :result_description, :exec
4
+ attr_accessor :url, :base_url, :task, :base_name, :inputs, :result_type, :result_description, :is_exec
5
5
 
6
- def initialize(base_url, task = nil, name = nil, inputs = nil, result_type = nil, result_description = nil, exec = false)
7
- if task.nil?
8
- @url = base_url
9
- else
10
- @base_url, @task, @name, @inputs, @result_type, @result_description = base_url, task, name, inputs, result_type, result_description
11
- if exec
12
- @url = [File.join(base_url, task.to_s), inputs]
13
- else
14
- self.fork
15
- end
16
- end
17
- end
18
-
19
- def initialize(base_url, task = nil, base_name = nil, inputs = nil, result_type = nil, result_description = nil, exec = false)
20
- @base_url, @task, @base_name, @inputs, @result_type, @result_description, @exec = base_url, task, base_name, inputs, result_type, result_description, exec
6
+ def initialize(base_url, task = nil, base_name = nil, inputs = nil, result_type = nil, result_description = nil, is_exec = false)
7
+ @base_url, @task, @base_name, @inputs, @result_type, @result_description, @is_exec = base_url, task, base_name, inputs, result_type, result_description, is_exec
21
8
  end
22
9
 
23
10
  def name
24
- return nil if exec
11
+ return nil if @is_exec
25
12
  (Array === @url ? @url.first : @url).split("/").last
26
13
  end
27
14
 
@@ -30,6 +17,7 @@ class WorkflowRESTClient
30
17
  end
31
18
 
32
19
  def info
20
+ init_job unless url
33
21
  info = WorkflowRESTClient.get_json(File.join(url, 'info'))
34
22
  info = WorkflowRESTClient.fix_hash(info)
35
23
  info[:status] = info[:status].to_sym if String === info[:status]
@@ -76,6 +64,7 @@ class WorkflowRESTClient
76
64
  end
77
65
 
78
66
  def get
67
+ params ||= {}
79
68
  params = params.merge(:_format => [:string, :boolean, :tsv, :annotations].include?(result_type) ? :raw : :json )
80
69
  begin
81
70
  WorkflowRESTClient.get_raw(url, params)
@@ -93,17 +82,27 @@ class WorkflowRESTClient
93
82
  res = WorkflowRESTClient.capture_exception do
94
83
  RestClient.post(URI.encode(File.join(base_url, task.to_s)), inputs.merge(:_cache_type => :exec, :_format => [:string, :boolean, :tsv, :annotations].include?(result_type) ? :raw : :json))
95
84
  end
96
- load_res res
85
+ loaded = load_res res
86
+ exit
87
+ loaded
97
88
  end
98
89
 
99
90
  def fork
100
- init_job
91
+ init_job(:asynchronous)
92
+ end
93
+
94
+ def running?
95
+ ! %w(done error aborted).include? status.to_s
96
+ end
97
+
98
+ def path
99
+ url
101
100
  end
102
101
 
103
102
  def run(noload = false)
104
- return exec_job if exec
103
+ return exec_job if @is_exec
105
104
  init_job(:synchronous)
106
- noload ? name : self.load
105
+ noload ? @name : self.load
107
106
  end
108
107
 
109
108
  def exec
@@ -116,7 +115,7 @@ class WorkflowRESTClient
116
115
  end
117
116
 
118
117
  def clean
119
- WorkflowRESTClient.get_raw(url, :_update => :clean) unless exec
118
+ WorkflowRESTClient.get_raw(url, :_update => :clean) unless @is_exec
120
119
  self
121
120
  end
122
121
  end
@@ -18,10 +18,14 @@ ul.tasks > li
18
18
  width: 5em
19
19
  float: right
20
20
 
21
- dd.job_control
21
+ dd.job_control, dd.job_files
22
+ +clearfix
22
23
  ul
23
- +rbbt_button_list($color_bg: $base3)
24
+ +rbbt_button_list($color_bg: $color_menu_bg)
25
+ +clearfix
26
+ background-color: $color_top_menu
24
27
  width: auto
28
+ float: left
25
29
  li a
26
30
 
27
31
 
@@ -14,3 +14,44 @@
14
14
  .form
15
15
  = partial_render('partials/form', :id => id, :action => action, :method => 'post',
16
16
  :enctype => "multipart/form-data", :info => task_info, :klass => 'workflow_task')
17
+
18
+ - if workflow.libdir.examples[task.to_s].exist?
19
+ .examples
20
+
21
+ %p
22
+ Click the links bellow to load example data:
23
+
24
+ :javascript
25
+ example_inputs = [];
26
+ %ul
27
+ - workflow.libdir.examples[task.to_s].glob('*').each do |example_dir|
28
+ - name = File.basename(example_dir)
29
+ - task_info = workflow.task_info task
30
+ - inputs = Workflow.load_inputs(example_dir, task_info[:inputs], task_info[:input_types])
31
+ - inputs.each{ |k,v| v.replace Open.read(v) if String === v and File.exists? v }
32
+ :javascript
33
+ example_inputs["#{ name }"] = #{inputs.to_json}
34
+ %li
35
+ %a.load_example(href="#" task=task name=name)= name
36
+
37
+ :javascript
38
+ deffer(function(){
39
+ $("a.load_example").click(function(){
40
+ var link = $(this);
41
+ var name = $(link).attr('name');
42
+ var inputs = example_inputs[name];
43
+ var form = link.parents('.workflow_task').find('.form')
44
+
45
+ for (var input in inputs){
46
+ var value = inputs[input]
47
+ var input = form.find('[name=' + input + ']')
48
+ if (input.is('[type=checkbox]')){
49
+ input.prop('checked', value)
50
+ }else{
51
+ input.val(value)
52
+ }
53
+ }
54
+ form.find('[name=jobname]').val(name)
55
+ return false
56
+ })
57
+ })
@@ -11,7 +11,7 @@
11
11
 
12
12
  - if job.files.any?
13
13
  %dt Files
14
- %dd
14
+ %dd.job_files
15
15
  %ul
16
16
  - job.files.each do |file|
17
17
  %li
@@ -1,8 +1,12 @@
1
1
  - table_id = [workflow.to_s, task, jobname] * "_"
2
2
  - table_class = 'workflow_tsv_result'
3
- - rows, total_size = tsv_rows(result)
3
+ - begin
4
+ - page = result.size > 50 ? "1" : nil
5
+ - rescue
6
+ - page = "1"
7
+
8
+ - rows, total_size = tsv_rows(result, page)
4
9
  - header = result.all_fields
5
- - page = total_size > 50 ? "1" : nil
6
10
 
7
11
  = workflow_partial('partials/table', workflow, task,
8
- locals.merge(:table_id => table_id, :page => page, :table_class => table_class, :rows => rows, :total_size => total_size, :header => result.all_fields, :row_ids => :use, :table_url => File.join('/', workflow.to_s, task, jobname)))
12
+ locals.merge(:table_id => table_id, :page => page, :table_class => table_class, :rows => rows, :total_size => total_size, :header => result.all_fields, :row_ids => :use, :table_url => jobname ? File.join('/', workflow.to_s, task, jobname) : nil))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -1128,7 +1128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1128
1128
  version: '0'
1129
1129
  requirements: []
1130
1130
  rubyforge_project:
1131
- rubygems_version: 2.2.1
1131
+ rubygems_version: 2.2.2
1132
1132
  signing_key:
1133
1133
  specification_version: 4
1134
1134
  summary: Rbbt Web and REST interfaces