ood_core 0.9.0 → 0.9.1
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 +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/ood_core/job/array_ids.rb +31 -9
- data/lib/ood_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9190913080e7b7448422cca14c7687a78dc32c65
|
4
|
+
data.tar.gz: 9afbd8380ad02e09840274c20e1f10d5c36569ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7728af206991073f9f32bcb12a8afa1b278899e62b7b0560ae813d6bdd6d97ae6ae7b872c39cc1be30afeb6054b42bfd6661b41950e0a58f3542253fcbff6163
|
7
|
+
data.tar.gz: efea743a3f4cf18d0beed8ad22c9934206ca60e5e351f01ef555a028d370f422fa55ecfd91a1f06d3e447692a1395ad5c0de43697c03fb766741750818f24aca
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
|
+
## [0.9.1] - 2019-05-07
|
10
|
+
### Added
|
11
|
+
- Added logic to `OodCore::Job::ArrayIds` to return an empty array when the array request is invalid
|
12
|
+
|
9
13
|
## [0.9.0] - 2019-05-04
|
10
14
|
### Added
|
11
15
|
- Job array support for LSF and PBSPro
|
@@ -177,7 +181,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
177
181
|
### Added
|
178
182
|
- Initial release!
|
179
183
|
|
180
|
-
[Unreleased]: https://github.com/OSC/ood_core/compare/v0.9.
|
184
|
+
[Unreleased]: https://github.com/OSC/ood_core/compare/v0.9.1...HEAD
|
185
|
+
[0.9.1]: https://github.com/OSC/ood_core/compare/v0.9.0...v0.9.1
|
181
186
|
[0.9.0]: https://github.com/OSC/ood_core/compare/v0.8.0...v0.9.0
|
182
187
|
[0.8.0]: https://github.com/OSC/ood_core/compare/v0.7.1...v0.8.0
|
183
188
|
[0.7.1]: https://github.com/OSC/ood_core/compare/v0.7.0...v0.7.1
|
@@ -1,19 +1,24 @@
|
|
1
1
|
# Builds a sorted array of job ids given a job array spec string
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Job array spec strings:
|
4
4
|
# 1 Single id
|
5
5
|
# 1-10 Range
|
6
6
|
# 1-10:2 Range with step
|
7
7
|
# 1-10,13 Compound (range with single id)
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# Note that Ranges are expected to be inclusive
|
10
10
|
module OodCore
|
11
11
|
module Job
|
12
12
|
class ArrayIds
|
13
|
+
class Error < StandardError ; end
|
14
|
+
|
13
15
|
attr_reader :ids
|
14
16
|
def initialize(spec_string)
|
15
17
|
@ids = []
|
16
|
-
|
18
|
+
begin
|
19
|
+
parse_spec_string(spec_string) if spec_string
|
20
|
+
rescue Error
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
protected
|
@@ -24,7 +29,9 @@ module OodCore
|
|
24
29
|
end
|
25
30
|
|
26
31
|
def get_components(spec_string)
|
27
|
-
discard_percent_modifier(spec_string)
|
32
|
+
base = discard_percent_modifier(spec_string)
|
33
|
+
raise Error unless base
|
34
|
+
base.split(',')
|
28
35
|
end
|
29
36
|
|
30
37
|
# A few adapters use percent to define an arrays maximum number of
|
@@ -34,22 +41,37 @@ module OodCore
|
|
34
41
|
end
|
35
42
|
|
36
43
|
def process_component(component)
|
37
|
-
is_range?(component)
|
44
|
+
if is_range?(component)
|
45
|
+
get_range(component)
|
46
|
+
elsif numbers_valid?([component])
|
47
|
+
[ component.to_i ]
|
48
|
+
else
|
49
|
+
raise Error
|
50
|
+
end
|
38
51
|
end
|
39
52
|
|
40
53
|
def get_range(component)
|
41
54
|
raw_range, raw_step = component.split(':')
|
42
|
-
start, stop = raw_range.split('-')
|
43
|
-
|
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)
|
44
61
|
step = raw_step.to_i
|
45
62
|
step = 1 if step == 0
|
46
|
-
|
63
|
+
|
47
64
|
range.step(step).to_a
|
48
65
|
end
|
49
66
|
|
50
67
|
def is_range?(component)
|
51
68
|
component.include?('-')
|
52
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
|
53
75
|
end
|
54
76
|
end
|
55
|
-
end
|
77
|
+
end
|
data/lib/ood_core/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.1
|
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: 2019-05-
|
13
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ood_support
|