ood_core 0.9.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +2 -2
- data/CHANGELOG.md +52 -2
- data/lib/ood_core.rb +1 -0
- data/lib/ood_core/batch_connect/template.rb +44 -2
- data/lib/ood_core/cluster.rb +15 -0
- data/lib/ood_core/clusters.rb +22 -10
- data/lib/ood_core/invalid_cluster.rb +37 -0
- data/lib/ood_core/job/adapter.rb +35 -4
- data/lib/ood_core/job/adapters/drmaa.rb +1 -1
- data/lib/ood_core/job/adapters/linux_host.rb +245 -0
- data/lib/ood_core/job/adapters/linux_host/launcher.rb +274 -0
- data/lib/ood_core/job/adapters/linux_host/templates/email.erb.sh +9 -0
- data/lib/ood_core/job/adapters/linux_host/templates/script_wrapper.erb.sh +64 -0
- data/lib/ood_core/job/adapters/lsf.rb +4 -0
- data/lib/ood_core/job/adapters/lsf/helper.rb +9 -3
- data/lib/ood_core/job/adapters/pbspro.rb +5 -0
- data/lib/ood_core/job/adapters/sge.rb +4 -0
- data/lib/ood_core/job/adapters/sge/batch.rb +1 -2
- data/lib/ood_core/job/adapters/sge/helper.rb +1 -0
- data/lib/ood_core/job/adapters/sge/qstat_xml_j_r_listener.rb +19 -4
- data/lib/ood_core/job/adapters/slurm.rb +25 -2
- data/lib/ood_core/job/adapters/torque.rb +5 -0
- data/lib/ood_core/job/array_ids.rb +18 -53
- data/lib/ood_core/job/script.rb +11 -2
- data/lib/ood_core/version.rb +1 -1
- data/ood_core.gemspec +2 -1
- metadata +24 -6
@@ -192,7 +192,7 @@ module OodCore
|
|
192
192
|
# @return [String] the id of the job that was created
|
193
193
|
def submit_string(str, args: [], env: {})
|
194
194
|
args = args.map(&:to_s) + ["--parsable"]
|
195
|
-
env =
|
195
|
+
env = env.to_h.each_with_object({}) { |(k, v), h| h[k.to_s] = v.to_s }
|
196
196
|
call("sbatch", *args, env: env, stdin: str.to_s).strip.split(";").first
|
197
197
|
end
|
198
198
|
|
@@ -394,7 +394,7 @@ module OodCore
|
|
394
394
|
|
395
395
|
# Set environment variables
|
396
396
|
env = script.job_environment || {}
|
397
|
-
args += ["--export",
|
397
|
+
args += ["--export", export_arg(env, script.copy_environment?)]
|
398
398
|
|
399
399
|
# Set native options
|
400
400
|
args += script.native if script.native
|
@@ -530,6 +530,10 @@ module OodCore
|
|
530
530
|
raise JobAdapterError, e.message unless /Invalid job id specified/ =~ e.message
|
531
531
|
end
|
532
532
|
|
533
|
+
def directive_prefix
|
534
|
+
'#SBATCH'
|
535
|
+
end
|
536
|
+
|
533
537
|
private
|
534
538
|
# Convert duration to seconds
|
535
539
|
def duration_in_seconds(time)
|
@@ -623,6 +627,25 @@ module OodCore
|
|
623
627
|
|
624
628
|
Info.new(**parent_task_hash)
|
625
629
|
end
|
630
|
+
|
631
|
+
|
632
|
+
# we default to export NONE, but SLURM defaults to ALL.
|
633
|
+
# we do this bc SLURM setups a new environment, loading /etc/profile
|
634
|
+
# and all giving 'module' function (among other things shells give),
|
635
|
+
# where the PUN did not.
|
636
|
+
# --export=ALL export the PUN's environment.
|
637
|
+
def export_arg(env, copy_environment)
|
638
|
+
if !env.empty? && !copy_environment
|
639
|
+
env.keys.join(",")
|
640
|
+
elsif !env.empty? && copy_environment
|
641
|
+
"ALL," + env.keys.join(",")
|
642
|
+
elsif env.empty? && copy_environment
|
643
|
+
# only this option changes behaivor dramatically
|
644
|
+
"ALL"
|
645
|
+
else
|
646
|
+
"NONE"
|
647
|
+
end
|
648
|
+
end
|
626
649
|
end
|
627
650
|
end
|
628
651
|
end
|
@@ -155,6 +155,7 @@ module OodCore
|
|
155
155
|
# Set environment variables
|
156
156
|
env = script.job_environment.to_h
|
157
157
|
args += ["-v", env.keys.join(",")] unless env.empty?
|
158
|
+
args += ["-V"] if script.copy_environment?
|
158
159
|
|
159
160
|
# If error_path is not specified we join stdout & stderr (as this
|
160
161
|
# mimics what the other resource managers do)
|
@@ -288,6 +289,10 @@ module OodCore
|
|
288
289
|
raise JobAdapterError, e.message
|
289
290
|
end
|
290
291
|
|
292
|
+
def directive_prefix
|
293
|
+
'#QSUB'
|
294
|
+
end
|
295
|
+
|
291
296
|
private
|
292
297
|
# Convert duration to seconds
|
293
298
|
def duration_in_seconds(time)
|
@@ -10,68 +10,33 @@
|
|
10
10
|
module OodCore
|
11
11
|
module Job
|
12
12
|
class ArrayIds
|
13
|
-
|
13
|
+
attr_reader :spec_string
|
14
14
|
|
15
|
-
attr_reader :ids
|
16
15
|
def initialize(spec_string)
|
17
|
-
@
|
18
|
-
begin
|
19
|
-
parse_spec_string(spec_string) if spec_string
|
20
|
-
rescue Error
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
protected
|
25
|
-
def parse_spec_string(spec_string)
|
26
|
-
@ids = get_components(spec_string).map{
|
27
|
-
|component| process_component(component)
|
28
|
-
}.reduce(:+).sort
|
16
|
+
@spec_string = spec_string
|
29
17
|
end
|
30
18
|
|
31
|
-
def
|
32
|
-
|
33
|
-
raise Error unless base
|
34
|
-
base.split(',')
|
19
|
+
def ids
|
20
|
+
@ids ||= parse_spec_string(spec_string)
|
35
21
|
end
|
36
22
|
|
37
|
-
|
38
|
-
# simultaneous tasks. The percent is expected to come at the end.
|
39
|
-
def discard_percent_modifier(spec_string)
|
40
|
-
spec_string.split('%').first
|
41
|
-
end
|
23
|
+
protected
|
42
24
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
25
|
+
def parse_spec_string(spec_string)
|
26
|
+
return [] unless spec_string
|
27
|
+
|
28
|
+
rx = /^(\d+)-?(\d+)?:?(\d+)?%?\d*$/
|
29
|
+
spec_string.split(',').reduce([]) do |ids, spec|
|
30
|
+
if rx =~ spec
|
31
|
+
start = ($1 || 1).to_i
|
32
|
+
finish = ($2 || start).to_i
|
33
|
+
step = ($3 || 1).to_i
|
34
|
+
ids.concat (start..finish).step(step).to_a
|
35
|
+
end
|
36
|
+
|
37
|
+
ids
|
50
38
|
end
|
51
39
|
end
|
52
|
-
|
53
|
-
def get_range(component)
|
54
|
-
raw_range, raw_step = component.split(':')
|
55
|
-
start, stop = raw_range.split('-')
|
56
|
-
raise Error unless numbers_valid?(
|
57
|
-
# Only include Step if it is not nil
|
58
|
-
[start, stop].tap { |a| a << raw_step if raw_step }
|
59
|
-
)
|
60
|
-
range = Range.new(start.to_i, stop.to_i)
|
61
|
-
step = raw_step.to_i
|
62
|
-
step = 1 if step == 0
|
63
|
-
|
64
|
-
range.step(step).to_a
|
65
|
-
end
|
66
|
-
|
67
|
-
def is_range?(component)
|
68
|
-
component.include?('-')
|
69
|
-
end
|
70
|
-
|
71
|
-
# Protect against Ruby's String#to_i returning 0 for arbitrary strings
|
72
|
-
def numbers_valid?(numbers)
|
73
|
-
numbers.all? { |str| /^[0-9]+$/ =~ str }
|
74
|
-
end
|
75
40
|
end
|
76
41
|
end
|
77
42
|
end
|
data/lib/ood_core/job/script.rb
CHANGED
@@ -104,6 +104,11 @@ module OodCore
|
|
104
104
|
# @return [Object, nil] native specifications
|
105
105
|
attr_reader :native
|
106
106
|
|
107
|
+
# Flag whether the job should contain a copy of its calling environment
|
108
|
+
# @return [Boolean] copy environment
|
109
|
+
attr_reader :copy_environment
|
110
|
+
alias_method :copy_environment?, :copy_environment
|
111
|
+
|
107
112
|
# @param content [#to_s] the script content
|
108
113
|
# @param args [Array<#to_s>, nil] arguments supplied to script
|
109
114
|
# @param submit_as_hold [Boolean, nil] whether job is held after submit
|
@@ -126,13 +131,15 @@ module OodCore
|
|
126
131
|
# @param wall_time [#to_i, nil] max real time
|
127
132
|
# @param accounting_id [#to_s, nil] accounting id
|
128
133
|
# @param native [Object, nil] native specifications
|
134
|
+
# @param copy_environment [Boolean, nil] copy the environment
|
129
135
|
def initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil,
|
130
136
|
job_environment: nil, workdir: nil, email: nil,
|
131
137
|
email_on_started: nil, email_on_terminated: nil,
|
132
138
|
job_name: nil, shell_path: nil, input_path: nil,
|
133
139
|
output_path: nil, error_path: nil, reservation_id: nil,
|
134
140
|
queue_name: nil, priority: nil, start_time: nil,
|
135
|
-
wall_time: nil, accounting_id: nil, job_array_request: nil,
|
141
|
+
wall_time: nil, accounting_id: nil, job_array_request: nil,
|
142
|
+
native: nil, copy_environment: nil, **_)
|
136
143
|
@content = content.to_s
|
137
144
|
|
138
145
|
@submit_as_hold = submit_as_hold
|
@@ -157,6 +164,7 @@ module OodCore
|
|
157
164
|
@accounting_id = accounting_id && accounting_id.to_s
|
158
165
|
@job_array_request = job_array_request && job_array_request.to_s
|
159
166
|
@native = native
|
167
|
+
@copy_environment = (copy_environment.nil?) ? nil : !! copy_environment
|
160
168
|
end
|
161
169
|
|
162
170
|
# Convert object to hash
|
@@ -184,7 +192,8 @@ module OodCore
|
|
184
192
|
wall_time: wall_time,
|
185
193
|
accounting_id: accounting_id,
|
186
194
|
job_array_request: job_array_request,
|
187
|
-
native: native
|
195
|
+
native: native,
|
196
|
+
copy_environment: copy_environment
|
188
197
|
}
|
189
198
|
end
|
190
199
|
|
data/lib/ood_core/version.rb
CHANGED
data/ood_core.gemspec
CHANGED
@@ -25,8 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_runtime_dependency "ood_support", "~> 0.0.2"
|
26
26
|
spec.add_runtime_dependency "ffi", "~> 1.9", ">= 1.9.6"
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.7"
|
28
|
-
spec.add_development_dependency "rake", "~>
|
28
|
+
spec.add_development_dependency "rake", "~> 13.0.1"
|
29
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
spec.add_development_dependency "pry", "~> 0.10"
|
31
31
|
spec.add_development_dependency "timecop", "~> 0.8"
|
32
|
+
spec.add_development_dependency "climate_control", "~> 0.2.0"
|
32
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ood_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Franz
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ood_support
|
@@ -66,14 +66,14 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 13.0.1
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 13.0.1
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: rspec
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,20 @@ dependencies:
|
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0.8'
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: climate_control
|
121
|
+
requirement: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.2.0
|
126
|
+
type: :development
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.2.0
|
119
133
|
description: Open OnDemand core library that provides support for an HPC Center to
|
120
134
|
globally define HPC services that web applications can then take advantage of.
|
121
135
|
email:
|
@@ -147,9 +161,14 @@ files:
|
|
147
161
|
- lib/ood_core/cluster.rb
|
148
162
|
- lib/ood_core/clusters.rb
|
149
163
|
- lib/ood_core/errors.rb
|
164
|
+
- lib/ood_core/invalid_cluster.rb
|
150
165
|
- lib/ood_core/job/adapter.rb
|
151
166
|
- lib/ood_core/job/adapters/drmaa.rb
|
152
167
|
- lib/ood_core/job/adapters/helper.rb
|
168
|
+
- lib/ood_core/job/adapters/linux_host.rb
|
169
|
+
- lib/ood_core/job/adapters/linux_host/launcher.rb
|
170
|
+
- lib/ood_core/job/adapters/linux_host/templates/email.erb.sh
|
171
|
+
- lib/ood_core/job/adapters/linux_host/templates/script_wrapper.erb.sh
|
153
172
|
- lib/ood_core/job/adapters/lsf.rb
|
154
173
|
- lib/ood_core/job/adapters/lsf/batch.rb
|
155
174
|
- lib/ood_core/job/adapters/lsf/helper.rb
|
@@ -196,8 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
215
|
- !ruby/object:Gem::Version
|
197
216
|
version: '0'
|
198
217
|
requirements: []
|
199
|
-
|
200
|
-
rubygems_version: 2.6.14
|
218
|
+
rubygems_version: 3.0.3
|
201
219
|
signing_key:
|
202
220
|
specification_version: 4
|
203
221
|
summary: Open OnDemand core library
|