rbbt-util 5.26.116 → 5.26.117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etc/app.d/semaphores.rb +2 -0
- data/lib/rbbt/entity.rb +13 -2
- data/lib/rbbt/hpc.rb +5 -0
- data/lib/rbbt/persist.rb +17 -4
- data/lib/rbbt/resource.rb +27 -20
- data/lib/rbbt/resource/util.rb +1 -0
- data/lib/rbbt/tsv/stream.rb +1 -1
- data/lib/rbbt/workflow.rb +5 -4
- data/lib/rbbt/workflow/remote/remote_step.rb +3 -1
- data/share/rbbt_commands/system/clean +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e59ee0bcb0a764c4bc10206585d0a26c7a59f881cca10dcaf3fbf693b0ed9208
|
4
|
+
data.tar.gz: 929459e6de52b9ba2f13b7fa55c2aac38a78ff13c6990f63143c68e2b35a6af8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d7ed4da1ec8ac8b63e1a91bccbb87b60a1d6c60fe3807f4c9f85f8c1dc82a1fd206382175184278dac40bce536a732e3da38383c0828e446b10cfcf647ac3d
|
7
|
+
data.tar.gz: fbed1b9e52b78a3f56eda4e5a0c0b39c9f21f8ff8faa66725ebaf2c11d27e3c71d4d630ce5acd7616dd86697d82114859fd46e5b45a256cad6364e800c045934
|
data/etc/app.d/semaphores.rb
CHANGED
data/lib/rbbt/entity.rb
CHANGED
@@ -5,6 +5,13 @@ module Entity
|
|
5
5
|
|
6
6
|
UNPERSISTED_PREFIX = "entity_unpersisted_property_"
|
7
7
|
|
8
|
+
class DontPersist < Exception
|
9
|
+
attr_accessor :payload
|
10
|
+
def self.initialize(payload)
|
11
|
+
@payload = payload
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
class << self
|
9
16
|
attr_accessor :formats, :entity_property_cache
|
10
17
|
end
|
@@ -203,8 +210,12 @@ module Entity
|
|
203
210
|
persist_options = options
|
204
211
|
persist_options = persist_options.merge(:other => {:args => args}) if args and args.any?
|
205
212
|
|
206
|
-
|
207
|
-
|
213
|
+
begin
|
214
|
+
Persist.persist(persist_name, type, persist_options.merge(:persist => true)) do
|
215
|
+
self.send(orig_name, *args)
|
216
|
+
end
|
217
|
+
rescue DontPersist
|
218
|
+
$!.payload
|
208
219
|
end
|
209
220
|
end
|
210
221
|
end
|
data/lib/rbbt/hpc.rb
CHANGED
@@ -295,6 +295,8 @@ EOF
|
|
295
295
|
|
296
296
|
target = File.expand_path(sync)
|
297
297
|
coda +=<<-EOF
|
298
|
+
|
299
|
+
# Sync data to target location
|
298
300
|
mkdir -p "$(dirname '#{target}')"
|
299
301
|
rsync -avztAXHP --copy-unsafe-links "#{source}/" "#{target}/" &>> #{fsync}
|
300
302
|
sync_es="$?"
|
@@ -310,6 +312,9 @@ fi
|
|
310
312
|
if singularity
|
311
313
|
coda +=<<-EOF
|
312
314
|
singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -v /dev/shm/sem.*.{in,out,process} /dev/shm/sem.Session-PID.*.sem 2> /dev/null >> #{fsync}
|
315
|
+
|
316
|
+
|
317
|
+
# Clean container directory
|
313
318
|
if [ $exit_status == '0' -a $sync_es == '0' ]; then
|
314
319
|
singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rbbt system clean -f &>> #{fsync}
|
315
320
|
singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -Rfv .rbbt/var/jobs &>> #{fsync}
|
data/lib/rbbt/persist.rb
CHANGED
@@ -41,12 +41,19 @@ module Persist
|
|
41
41
|
return false if not Open.exists? path
|
42
42
|
return false if TrueClass === persist_options[:update]
|
43
43
|
|
44
|
+
expiration = persist_options[:expiration]
|
45
|
+
if expiration
|
46
|
+
seconds = Misc.timespan(expiration)
|
47
|
+
patht = Open.mtime(path)
|
48
|
+
return false if Time.now > patht + seconds
|
49
|
+
end
|
50
|
+
|
44
51
|
check = persist_options[:check]
|
45
52
|
return true if check.nil?
|
46
53
|
|
47
54
|
missing = check.reject{|file| Open.exists?(file) }
|
48
55
|
return false if missing.any?
|
49
|
-
|
56
|
+
|
50
57
|
return true unless ENV["RBBT_UPDATE"]
|
51
58
|
|
52
59
|
if Array === check
|
@@ -497,7 +504,7 @@ module LocalPersist
|
|
497
504
|
attr_accessor :local_persist_dir
|
498
505
|
|
499
506
|
def local_persist_dir
|
500
|
-
@local_persist_dir ||= Rbbt.var.cache.persistence if defined? Rbbt
|
507
|
+
@local_persist_dir ||= Rbbt.var.cache.persistence.find(:lib) if defined? Rbbt
|
501
508
|
@local_persist_dir
|
502
509
|
end
|
503
510
|
|
@@ -505,13 +512,19 @@ module LocalPersist
|
|
505
512
|
@local_persist_dir = value
|
506
513
|
end
|
507
514
|
|
508
|
-
def local_persist(name, type = nil, options= {}, persist_options = nil, &block)
|
515
|
+
def self.local_persist(name, type = nil, options= {}, persist_options = nil, &block)
|
509
516
|
persist_options ||= {}
|
510
|
-
persist_options = {:dir =>
|
517
|
+
persist_options = {:dir => Rbbt.var.cache.persistence.find(:lib)}.merge persist_options
|
511
518
|
persist_options[:other] = options
|
512
519
|
Persist.persist(name, type, persist_options, &block)
|
513
520
|
end
|
514
521
|
|
522
|
+
def local_persist(name, type = nil, options= {}, persist_options = nil, &block)
|
523
|
+
persist_options ||= {}
|
524
|
+
persist_options = {:dir => local_persist_dir}.merge persist_options
|
525
|
+
self.local_persist(name, type, options, persist_options, &block)
|
526
|
+
end
|
527
|
+
|
515
528
|
def local_persist_tsv(source, name, opt = {}, options= {}, &block)
|
516
529
|
Persist.persist_tsv(source, name, opt, options.merge({:dir => local_persist_dir, :persist => true}), &block)
|
517
530
|
end
|
data/lib/rbbt/resource.rb
CHANGED
@@ -86,29 +86,36 @@ module Resource
|
|
86
86
|
lock_filename = nil # it seems like this was locked already.
|
87
87
|
|
88
88
|
Misc.lock lock_filename do
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
uri = URI(url)
|
90
|
+
|
91
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
92
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
93
|
+
timeout = 60 * 10
|
94
|
+
Net::HTTP.start(uri.host, uri.port, :timeout => timeout, :read_timeout => timeout, :open_timeout => timeout) do |http|
|
95
|
+
http.request request do |response|
|
96
|
+
case response
|
97
|
+
when Net::HTTPSuccess, Net::HTTPOK
|
98
|
+
Misc.sensiblewrite(final_path) do |file|
|
99
|
+
response.read_body do |chunk|
|
100
|
+
file.write chunk
|
101
|
+
end
|
95
102
|
end
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
103
|
+
when Net::HTTPRedirection, Net::HTTPFound
|
104
|
+
location = response['location']
|
105
|
+
Log.debug("Feching directory from: #{location}. Into: #{final_path}")
|
106
|
+
FileUtils.mkdir_p final_path unless File.exist? final_path
|
107
|
+
TmpFile.with_file do |tmp_dir|
|
108
|
+
Misc.in_dir tmp_dir do
|
109
|
+
CMD.cmd('tar xvfz -', :in => Open.open(location, :nocache => true))
|
110
|
+
end
|
111
|
+
FileUtils.mv tmp_dir, final_path
|
104
112
|
end
|
105
|
-
|
113
|
+
when Net::HTTPInternalServerError
|
114
|
+
@server_missing_resource_cache << url
|
115
|
+
raise "Resource Not Found"
|
116
|
+
else
|
117
|
+
raise "Response not understood: #{response.inspect}"
|
106
118
|
end
|
107
|
-
when Net::HTTPInternalServerError
|
108
|
-
@server_missing_resource_cache << url
|
109
|
-
raise "Resource Not Found"
|
110
|
-
else
|
111
|
-
raise "Response not understood: #{response.inspect}"
|
112
119
|
end
|
113
120
|
end
|
114
121
|
end
|
data/lib/rbbt/resource/util.rb
CHANGED
data/lib/rbbt/tsv/stream.rb
CHANGED
data/lib/rbbt/workflow.rb
CHANGED
@@ -46,8 +46,8 @@ module Workflow
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.require_remote_workflow(wf_name, url)
|
49
|
-
require 'rbbt/
|
50
|
-
eval "Object::#{wf_name} =
|
49
|
+
require 'rbbt/workflow/remote/client'
|
50
|
+
eval "Object::#{wf_name} = WorkflowRemoteClient.new '#{ url }', '#{wf_name}'"
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.require_remote_workflow(wf_name, url)
|
@@ -682,14 +682,15 @@ module Workflow
|
|
682
682
|
end
|
683
683
|
|
684
684
|
def self.process_remote_tasks(remote_tasks)
|
685
|
-
require 'rbbt/
|
685
|
+
require 'rbbt/workflow/remote/client'
|
686
686
|
remote_tasks.each do |workflow, info|
|
687
687
|
wf = Workflow.require_workflow workflow
|
688
688
|
wf.remote_tasks ||= {}
|
689
689
|
IndiferentHash.setup wf.remote_tasks
|
690
690
|
info.each do |remote, tasks|
|
691
|
-
remote_wf =
|
691
|
+
remote_wf = WorkflowRemoteClient.new remote, workflow
|
692
692
|
tasks.each do |task|
|
693
|
+
Log.debug "Add remote task #{task} in #{wf} using #{remote_wf.url}"
|
693
694
|
wf.remote_tasks[task.to_sym] = remote_wf
|
694
695
|
end
|
695
696
|
end
|
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.26.
|
4
|
+
version: 5.26.117
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|