rbbt-util 5.34.5 → 5.34.7

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
  SHA256:
3
- metadata.gz: '073587b420676db7c055e58dbabaecbf04a7b30ba9d7ea912f1c12df5a6d180d'
4
- data.tar.gz: 6d263d07b85095fefb48c15692af0db66b56ef671ada83e98c66a4765d4ca416
3
+ metadata.gz: ec5860171e51e2e53a8383ae8ea1156b79c7f75194d384c5aa2c43efd759e129
4
+ data.tar.gz: a6ab8a782b3169eae1e475a2029e8a4f0ac2d12f375475ec70de9d97f513f21a
5
5
  SHA512:
6
- metadata.gz: 945c0f4b9d6f99024f6610dc2eb0c52c6546606937fff72558281ecf5d2aaddeb2e32ce3373b9348fa764e8e7285cdcdad6916118ba259d61c24b4b3477e3317
7
- data.tar.gz: a8ba069b626b1a09d6da8e73eaa901119795ade4b4af33f1891b8581cfe80ccf48ca439a6a96b67f45e6bdf687ba7e90df263b8b4caabec18af45f6008e2b5d9
6
+ metadata.gz: 2fb6a8ac5abee267891f6bb0736b659f202019de75fa0ecef80e955838a54013eaeabb495c44daff45196a8706821b706bfae75b095ce3ca8b82e8351436d4ef
7
+ data.tar.gz: ab24e4ab588e75f94adfcd9a02e178511bd4471edadef18c6c49537974353b8b4d83c61438d8fe638acbc26101556637a92d5da325ebc135736da44558971334
@@ -16,6 +16,9 @@ module TSV
16
16
 
17
17
  def annotate(tsv)
18
18
  TSV.setup(tsv, info)
19
+ tsv.entity_options = self.entity_options
20
+ tsv.entity_templates = self.entity_templates
21
+ tsv
19
22
  end
20
23
 
21
24
  def entity_options
@@ -389,7 +389,7 @@ module TSV
389
389
  when Set
390
390
  traverse_array(obj.to_a, options, &block)
391
391
  when String
392
- if Open.remote?(obj) or Misc.is_filename?(obj)
392
+ if Open.remote?(obj) || Open.ssh?(obj) || Misc.is_filename?(obj)
393
393
  Open.open(obj) do |s|
394
394
  traverse_obj(s, options, &block)
395
395
  end
@@ -135,20 +135,25 @@ def self.add_libdir(dir=nil)
135
135
  end
136
136
 
137
137
  def self.insist(times = 4, sleep = nil, msg = nil)
138
- if Array === times
139
- sleep_array = times
140
- times = sleep_array.length
141
- sleep = sleep_array.shift
142
- end
143
- try = 0
144
-
145
- if sleep.nil?
146
- sleep_array = ([0] + [0.001, 0.01, 0.1, 0.5] * (times / 3)).sort[0..times-1]
147
- sleep = sleep_array.shift
148
- end
138
+ sleep_array = nil
149
139
 
140
+ try = 0
150
141
  begin
151
- yield
142
+ begin
143
+ yield
144
+ rescue Exception
145
+ if Array === times
146
+ sleep_array = times
147
+ times = sleep_array.length
148
+ sleep = sleep_array.shift
149
+ end
150
+
151
+ if sleep.nil?
152
+ sleep_array = ([0] + [0.001, 0.01, 0.1, 0.5] * (times / 3)).sort[0..times-1]
153
+ sleep = sleep_array.shift
154
+ end
155
+ raise $!
156
+ end
152
157
  rescue TryAgain
153
158
  sleep sleep
154
159
  retry
@@ -522,7 +522,7 @@ module Open
522
522
  # Questions
523
523
 
524
524
  def self.remote?(file)
525
- !! (file =~ /^(?:https?|ftp):\/\//)
525
+ !! (file =~ /^(?:https?|ftp|ssh):\/\//)
526
526
  end
527
527
 
528
528
  def self.ssh?(file)
@@ -18,7 +18,24 @@ class RemoteWorkflow
18
18
  end
19
19
  end
20
20
 
21
+ def self.escape_url(url)
22
+ base, _sep, query = url.partition("?")
23
+ protocol, path = base.split("://")
24
+ path = protocol if path.nil?
25
+ path = path.split("/").collect{|p| CGI.escape(p) }* "/"
26
+ base = protocol ? [protocol, path] * "://" : path
27
+
28
+ if query && ! query.empty?
29
+ query = query.split("&").collect{|e| e.split("=").collect{|pe| CGI.escape(pe) } * "=" } * "&"
30
+ [base, query] * "?"
31
+ else
32
+ base
33
+ end
34
+ end
35
+
21
36
  def self.encode(url)
37
+ # ToDo: Check this
38
+ return escape_url(url)
22
39
  begin
23
40
  URI::DEFAULT_PARSER.escape(url)
24
41
  rescue
@@ -135,7 +152,7 @@ class RemoteWorkflow
135
152
 
136
153
  def self.execute_job(base_url, task, task_params, cache_type)
137
154
  RemoteWorkflow.capture_exception do
138
- task_url = URI.encode(File.join(base_url, task.to_s))
155
+ task_url = self.escape_url(File.join(base_url, task.to_s))
139
156
 
140
157
  sout, sin = Misc.pipe
141
158
 
@@ -132,7 +132,7 @@ class RemoteStep
132
132
  def _run_job(cache_type = :asynchronous)
133
133
  get_streams
134
134
 
135
- task_url = URI.encode(File.join(base_url, task.to_s))
135
+ task_url = RemoteWorkflow::REST.escape_url(File.join(base_url, task.to_s))
136
136
  @adaptor.__prepare_inputs_for_restclient(inputs)
137
137
  task_params = inputs.merge(:_cache_type => cache_type, :jobname => base_name, :_format => [:string, :boolean, :tsv, :annotations].include?(result_type) ? :raw : :json)
138
138
 
@@ -147,6 +147,7 @@ class RemoteStep
147
147
 
148
148
  def produce(*args)
149
149
  @started = true
150
+ init_job
150
151
  _run_job
151
152
  end
152
153
 
@@ -177,7 +177,7 @@ class Step
177
177
 
178
178
  Log.debug "Saving job input #{name} (#{type}) into #{path}"
179
179
 
180
- if value.respond_to? :filename
180
+ if IO === value && value.respond_to?(:filename) && value.filename
181
181
  Open.write(path, value.filename)
182
182
  elsif IO === value
183
183
  Open.write(path, value)
@@ -75,6 +75,7 @@ class Step
75
75
 
76
76
  def dirty?
77
77
  return true if Open.exists?(pid_file) && ! ( Open.exists?(info_file) || done? )
78
+ return true if done? && ! (status == :done || status == :noinfo)
78
79
  return false unless done? || status == :done
79
80
  return false unless ENV["RBBT_UPDATE"] == "true"
80
81
 
@@ -96,6 +96,8 @@ Misc.in_dir(app_dir) do
96
96
  system ENV, "env RBBT_LOG=0 passenger start -R '#{config_ru_file}' -p #{options[:Port] || "2887"}"
97
97
  when 'puma_alt'
98
98
  system ENV, "puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 3 -t 8:32 --preload"
99
+ when 'puma_production'
100
+ CMD.cmd_log("env RBBT_LOG=#{Log.severity.to_s} puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 20 -t 10:160 --preload")
99
101
  else
100
102
  options[:config] = config_ru_file
101
103
  options[:threads] = "8:8"
@@ -47,6 +47,7 @@ tsv = TSV.open(tsv) if IO === tsv
47
47
 
48
48
 
49
49
  begin
50
+ require 'rbbt/workflow'
50
51
  Workflow.require_workflow "Genomics"
51
52
  tsv = Genomics.job(:names, nil, :tsv => tsv).run
52
53
  rescue
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.34.5
4
+ version: 5.34.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake