rbbt-util 5.32.9 → 5.32.10

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: 3b9d236294c4bdcc32e517eadcffa4d103e5a99a220096497a50f8baa26f746d
4
- data.tar.gz: 6370930ac76bd8b86666fa59556d2d8648789c3e3dda56bb71c71c2ff65b88d3
3
+ metadata.gz: 258c55a2b59d81426d1aa3980f35104ef193774068330b25c9aad29061d70e6a
4
+ data.tar.gz: 8265a128c161349455f7803d5a70a259c03481bb7a441aa1ffec58626fbb0226
5
5
  SHA512:
6
- metadata.gz: 7dcd6fadf6424add27b6773d16ef0b794183c4b2f52616498d8c2ec21a77c5b5ad8f3fed65ca69ce5111c71e0942f84be79c107b40156c331919533f3fc5bea7
7
- data.tar.gz: ea294d8aa5f8ff04a9e902fdd2d7d2287a34934f7288a11234996d06fb72dba4f333e655d591d9b78c5bc00104036356625088f9aa4c7e808ae2d42d0b253781
6
+ metadata.gz: 8eb143ab5cf5e4e55851ccd11b24eeae7d3e60948e30a71de3b5fb87f5333d7e40823b268d6ac894eea5d3d73ffa47101f7bb229378837799597df54545bb8c8
7
+ data.tar.gz: 0ebddaae9d523d9dd767dfde1b351b011ba3dd65c4abd7c0bcc0e78cc3e604a6850250bf0e74dac9f5ca0172a56a067541bdc34b5037e2ffc7ba972558f2ce4c
@@ -28,6 +28,8 @@ export BATCH_SYSTEM=SLURM
28
28
  workdir = Misc.process_options options, :workdir
29
29
  exclusive = Misc.process_options options, :exclusive
30
30
  highmem = Misc.process_options options, :highmem
31
+ licenses = Misc.process_options options, :licenses
32
+ constraint = Misc.process_options options, :constraint
31
33
 
32
34
  batch_dir = Misc.process_options options, :batch_dir
33
35
  batch_name = Misc.process_options options, :batch_name
@@ -51,6 +53,8 @@ export BATCH_SYSTEM=SLURM
51
53
 
52
54
  header << "#SBATCH --exclusive" << "\n" if exclusive
53
55
  header << "#SBATCH --constraint=highmem" << "\n" if highmem
56
+ header << "#SBATCH --licenses=#{licenses}" << "\n" if licenses
57
+ header << "#SBATCH --constraint=#{constraint}" << "\n" if constraint
54
58
 
55
59
  header
56
60
  end
@@ -148,11 +148,7 @@ module Persist
148
148
  def write_lock
149
149
  write if closed?
150
150
  if write?
151
- begin
152
- return yield
153
- ensure
154
- close
155
- end
151
+ return yield
156
152
  end
157
153
 
158
154
  lock do
data/lib/rbbt/resource.rb CHANGED
@@ -4,10 +4,10 @@ require 'rbbt/resource/path'
4
4
  require 'net/http'
5
5
  require 'set'
6
6
 
7
-
8
7
  module Resource
9
8
  class ResourceNotFound < RbbtException; end
10
9
 
10
+
11
11
  class << self
12
12
  attr_accessor :lock_dir
13
13
 
@@ -90,51 +90,62 @@ module Resource
90
90
  uri = URI(url)
91
91
 
92
92
  http = Net::HTTP.new(uri.host, uri.port)
93
- request = Net::HTTP::Get.new(uri.request_uri)
93
+
94
+ if uri.scheme == "https"
95
+ http.use_ssl = true
96
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
97
+ http.instance_variable_set("@ssl_options", OpenSSL::SSL::OP_NO_SSLv2 + OpenSSL::SSL::OP_NO_SSLv3 + OpenSSL::SSL::OP_NO_COMPRESSION)
98
+ end
99
+
94
100
  timeout = 60 * 10
95
- Net::HTTP.start(uri.host, uri.port, :timeout => timeout, :read_timeout => timeout, :open_timeout => timeout) do |http|
96
- http.request request do |response|
97
- filename = if response["Content-Disposition"]
98
- response["Content-Disposition"].split(";").select{|f| f.include? "filename"}.collect{|f| f.split("=").last.gsub('"','')}.first
99
- else
100
- nil
101
- end
102
-
103
- if filename && filename =~ /\.b?gz$/ && final_path !~ /\.b?gz$/
104
- extension = filename.split(".").last
105
- final_path += '.' + extension
106
- end
107
- case response
108
- when Net::HTTPSuccess, Net::HTTPOK
109
- Misc.sensiblewrite(final_path) do |file|
110
- response.read_body do |chunk|
111
- file.write chunk
112
- end
101
+ http.read_timeout = timeout
102
+ http.open_timeout = timeout
103
+ request = Net::HTTP::Get.new(uri.request_uri)
104
+ http.request request do |response|
105
+ filename = if response["Content-Disposition"]
106
+ response["Content-Disposition"].split(";").select{|f| f.include? "filename"}.collect{|f| f.split("=").last.gsub('"','')}.first
107
+ else
108
+ nil
109
+ end
110
+
111
+ if filename && filename =~ /\.b?gz$/ && final_path !~ /\.b?gz$/
112
+ extension = filename.split(".").last
113
+ final_path += '.' + extension
114
+ end
115
+ case response
116
+ when Net::HTTPSuccess, Net::HTTPOK
117
+ Misc.sensiblewrite(final_path) do |file|
118
+ response.read_body do |chunk|
119
+ file.write chunk
113
120
  end
114
- when Net::HTTPRedirection, Net::HTTPFound
115
- location = response['location']
116
- if location.include? 'get_directory'
117
- Log.debug("Feching directory from: #{location}. Into: #{final_path}")
118
- FileUtils.mkdir_p final_path unless File.exist? final_path
119
- TmpFile.with_file do |tmp_dir|
120
- Misc.in_dir tmp_dir do
121
- CMD.cmd('tar xvfz -', :in => Open.open(location, :nocache => true))
122
- end
123
- FileUtils.mv tmp_dir, final_path
124
- end
125
- else
126
- Open.open(location, :nocache => true) do |s|
127
- Misc.sensiblewrite(final_path, s)
121
+ end
122
+ when Net::HTTPRedirection, Net::HTTPFound
123
+ location = response['location']
124
+ if location.include? 'get_directory'
125
+ Log.debug("Feching directory from: #{location}. Into: #{final_path}")
126
+ FileUtils.mkdir_p final_path unless File.exist? final_path
127
+ TmpFile.with_file do |tmp_dir|
128
+ Misc.in_dir tmp_dir do
129
+ CMD.cmd('tar xvfz -', :in => Open.open(location, :nocache => true))
128
130
  end
131
+ FileUtils.mv tmp_dir, final_path
129
132
  end
130
- when Net::HTTPInternalServerError
131
- @server_missing_resource_cache << url
132
- raise "Resource Not Found"
133
133
  else
134
- raise "Response not understood: #{response.inspect}"
134
+ url = location
135
+ raise TryAgain
136
+ #Open.open(location, :nocache => true) do |s|
137
+ # Misc.sensiblewrite(final_path, s)
138
+ #end
135
139
  end
140
+ when Net::HTTPInternalServerError
141
+ @server_missing_resource_cache << url
142
+ raise "Resource Not Found"
143
+ else
144
+ raise "Response not understood: #{response.inspect}"
136
145
  end
137
146
  end
147
+ rescue TryAgain
148
+ retry
138
149
  end
139
150
  rescue
140
151
  Log.warn "Could not retrieve (#{self.to_s}) #{ path } from #{ remote_server }"
@@ -25,8 +25,10 @@ $slurm_options = SOPT.get <<EOF
25
25
  -BPP--batch_procpath* Save Procpath performance for batch job; specify only options
26
26
  -q--queue* Queue
27
27
  -t--task_cpus* Tasks
28
- -W--workflows* Additional workflows
29
28
  -tm--time* Time
29
+ -lin--licenses* SLURM licenses
30
+ -cons--constraint* SLURM constraint
31
+ -W--workflows* Additional workflows
30
32
  -OR--orchestration_rules* Orchestration rules
31
33
  -rmb--remove_batch_basedir Remove the SLURM working directory (command, STDIN, exit status, ...)
32
34
  EOF
@@ -24,8 +24,10 @@ $slurm_options = SOPT.get <<EOF
24
24
  -BPP--batch_procpath* Save Procpath performance for batch job; specify only options
25
25
  -q--queue* Queue
26
26
  -t--task_cpus* Tasks
27
- -W--workflows* Additional workflows
28
27
  -tm--time* Time
28
+ -lin--licenses* SLURM licenses
29
+ -cons--constraint* SLURM constraint
30
+ -W--workflows* Additional workflows
29
31
  -rmb--remove_batch_dir Remove the batch working directory (command, STDIN, exit status, ...)
30
32
  -bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
31
33
  EOF
@@ -25,8 +25,10 @@ $slurm_options = SOPT.get <<EOF
25
25
  -BPP--batch_procpath* Save Procpath performance for batch job; specify only options
26
26
  -q--queue* Queue
27
27
  -t--task_cpus* Tasks
28
- -W--workflows* Additional workflows
29
28
  -tm--time* Time
29
+ -lin--licenses* SLURM licenses
30
+ -cons--constraint* SLURM constraint
31
+ -W--workflows* Additional workflows
30
32
  -OR--orchestration_rules* Orchestration rules
31
33
  -rmb--remove_batch_basedir Remove the SLURM working directory (command, STDIN, exit status, ...)
32
34
  EOF
@@ -24,8 +24,10 @@ $slurm_options = SOPT.get <<EOF
24
24
  -BPP--batch_procpath* Save Procpath performance for batch job; specify only options
25
25
  -q--queue* Queue
26
26
  -t--task_cpus* Tasks
27
- -W--workflows* Additional workflows
28
27
  -tm--time* Time
28
+ -lin--licenses* SLURM licenses
29
+ -cons--constraint* SLURM constraint
30
+ -W--workflows* Additional workflows
29
31
  -rmb--remove_batch_dir Remove the batch working directory (command, STDIN, exit status, ...)
30
32
  -bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
31
33
  EOF
@@ -25,8 +25,10 @@ $slurm_options = SOPT.get <<EOF
25
25
  -BPP--batch_procpath* Save Procpath performance for batch job; specify only options
26
26
  -q--queue* Queue
27
27
  -t--task_cpus* Tasks
28
- -W--workflows* Additional workflows
29
28
  -tm--time* Time
29
+ -lin--licenses* SLURM licenses
30
+ -cons--constraint* SLURM constraint
31
+ -W--workflows* Additional workflows
30
32
  -OR--orchestration_rules* Orchestration rules
31
33
  -rmb--remove_batch_basedir Remove the SLURM working directory (command, STDIN, exit status, ...)
32
34
  EOF
@@ -24,8 +24,10 @@ $slurm_options = SOPT.get <<EOF
24
24
  -BPP--batch_procpath* Save Procpath performance for batch job; specify only options
25
25
  -q--queue* Queue
26
26
  -t--task_cpus* Tasks
27
- -W--workflows* Additional workflows
28
27
  -tm--time* Time
28
+ -lin--licenses* SLURM licenses
29
+ -cons--constraint* SLURM constraint
30
+ -W--workflows* Additional workflows
29
31
  -rmb--remove_batch_dir Remove the batch working directory (command, STDIN, exit status, ...)
30
32
  -bs--batch_system* Batch system to use: auto, lsf, slurm (default is auto-detect)
31
33
  EOF
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.32.9
4
+ version: 5.32.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-03 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake