ood_core 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 782152957ec640f1ad747a00996a8f1dd723831e
4
- data.tar.gz: 46bc4f5f5697cf66af2de7628be05d83c75eb9f7
3
+ metadata.gz: 0cf4709dc9c8753f8229ae67403a0498e9cb8602
4
+ data.tar.gz: 2f555177a357923753dc246aa4c56811349d4b74
5
5
  SHA512:
6
- metadata.gz: 37ae31a647021f728f49fc57c4c6c88c194ce14e458dd2c127f2fc6a1de9f3cdd115f9bd0acbf23e4c7f0783ade982a172b1a14e439b06495c719bee4366ece6
7
- data.tar.gz: 7207ff48dcb977700d2974426eb9e993830c661e17d4db2ab9c020e3b984d07c4afe990763606bca9f169555e0fb397baf580f8d1c4799d5a8eb1488bf7d1738
6
+ metadata.gz: 702a25970cf24f9cda29e2adbd57c64003fc3cc60cc07b1da89f2d1c4bb5fb3153e688081c58139fd8ba7cb5623f6a08e16cbbf13737ee61194d1aafcb3d5a8a
7
+ data.tar.gz: ff5b02ee6b00d43b14568ad91768fcd8b1c8bde7166c112b2df215702bb1f7632e0e154e1954bb974ed1a3e1c71736e3f2aa88385d1d8563e20ab2759ea45ab7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.0.2 (2017-04-27)
4
+
5
+ Features:
6
+
7
+ - removed the `OodCore::Job::NodeRequest` object
8
+
3
9
  ## 0.0.1 (2017-04-17)
4
10
 
5
11
  Initial release!
data/lib/ood_core.rb CHANGED
@@ -8,7 +8,6 @@ module OodCore
8
8
  # A namespace for job access
9
9
  module Job
10
10
  require "ood_core/job/node_info"
11
- require "ood_core/job/node_request"
12
11
  require "ood_core/job/script"
13
12
  require "ood_core/job/info"
14
13
  require "ood_core/job/status"
@@ -103,12 +103,6 @@ module OodCore
103
103
  resources = {}
104
104
  resources.merge!(mem: "#{script.min_phys_memory}KB") unless script.min_phys_memory.nil?
105
105
  resources.merge!(walltime: seconds_to_duration(script.wall_time)) unless script.wall_time.nil?
106
- if script.nodes && !script.nodes.empty?
107
- # Reduce an array to unique objects with count
108
- # ["a", "a", "b"] #=> {"a" => 2, "b" => 1}
109
- nodes = script.nodes.group_by {|v| v}.each_with_object({}) {|(k, v), h| h[k] = v.size}
110
- resources.merge!(nodes: nodes.map {|k, v| k.is_a?(NodeRequest) ? node_request_to_str(k, v) : k }.join('+'))
111
- end
112
106
 
113
107
  # Set environment variables
114
108
  envvars = script.job_environment || {}
@@ -239,14 +233,6 @@ module OodCore
239
233
  end
240
234
  end
241
235
 
242
- # Convert a NodeRequest object to a valid Torque string
243
- def node_request_to_str(node, cnt)
244
- str = cnt.to_s
245
- str += ":ppn=#{node.procs}" if node.procs
246
- str += ":#{node.properties.join(':')}" if node.properties
247
- str
248
- end
249
-
250
236
  # Parse hash describing PBS job status
251
237
  def parse_job_info(k, v)
252
238
  /^(?<job_owner>[\w-]+)@/ =~ v[:Job_Owner]
@@ -100,24 +100,6 @@ module OodCore
100
100
  # @return [String, nil] accounting id
101
101
  attr_reader :accounting_id
102
102
 
103
- # Node or list of nodes detailing the specifications the job should run on
104
- # @example Job to run on a list of defined nodes
105
- # my_script.nodes
106
- # #=> ["n0001", "n0002", "n0003"]
107
- # @example Job to run on 2 nodes with 12 procs per node
108
- # my_script.nodes
109
- # #=> [
110
- # # #<OodCore::Job::NodeRequest procs=12, properties={}>,
111
- # # #<OodCore::Job::NodeRequest procs=12, properties={}>
112
- # # ]
113
- # @example Create job script that will run on 100 nodes with 20 procs per node
114
- # OodCore::Job::Script.new(
115
- # script: Pathname.new('/path/to/script'),
116
- # nodes: [OodCore::Job::NodeRequest.new(procs: 20)] * 100
117
- # )
118
- # @return [Array<String, NodeRequest>, nil] list of nodes
119
- attr_reader :nodes
120
-
121
103
  # Object detailing any native specifications that are implementation specific
122
104
  # @note Should not be used at all costs.
123
105
  # @return [Object, nil] native specifications
@@ -144,7 +126,6 @@ module OodCore
144
126
  # @param start_time [#to_i, nil] eligible start time
145
127
  # @param wall_time [#to_i, nil] max real time
146
128
  # @param accounting_id [#to_s, nil] accounting id
147
- # @param nodes [#to_h, #to_s, Array<#to_h, #to_s>, nil] list of nodes
148
129
  # @param native [Object, nil] native specifications
149
130
  def initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil,
150
131
  job_environment: nil, workdir: nil, email: nil,
@@ -152,7 +133,7 @@ module OodCore
152
133
  input_path: nil, output_path: nil, error_path: nil,
153
134
  join_files: nil, reservation_id: nil, queue_name: nil,
154
135
  priority: nil, min_phys_memory: nil, start_time: nil,
155
- wall_time: nil, accounting_id: nil, nodes: nil, native: nil,
136
+ wall_time: nil, accounting_id: nil, native: nil,
156
137
  **_)
157
138
  @content = content.to_s
158
139
 
@@ -177,7 +158,6 @@ module OodCore
177
158
  @start_time = start_time && Time.at(start_time.to_i)
178
159
  @wall_time = wall_time && wall_time.to_i
179
160
  @accounting_id = accounting_id && accounting_id.to_s
180
- @nodes = nodes && Array.wrap(nodes).map { |n| n.respond_to?(:to_h) ? NodeRequest.new(n.to_h) : n.to_s }
181
161
  @native = native
182
162
  end
183
163
 
@@ -206,7 +186,6 @@ module OodCore
206
186
  start_time: start_time,
207
187
  wall_time: wall_time,
208
188
  accounting_id: accounting_id,
209
- nodes: nodes,
210
189
  native: native
211
190
  }
212
191
  end
@@ -1,4 +1,4 @@
1
1
  module OodCore
2
2
  # The current version of {OodCore}
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ood_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Nicklas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-17 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ood_support
@@ -148,7 +148,6 @@ files:
148
148
  - lib/ood_core/job/factory.rb
149
149
  - lib/ood_core/job/info.rb
150
150
  - lib/ood_core/job/node_info.rb
151
- - lib/ood_core/job/node_request.rb
152
151
  - lib/ood_core/job/script.rb
153
152
  - lib/ood_core/job/status.rb
154
153
  - lib/ood_core/refinements/array_extensions.rb
@@ -1,51 +0,0 @@
1
- require 'ood_core/refinements/array_extensions'
2
-
3
- module OodCore
4
- module Job
5
- # An object that describes a request for a node when submitting a job
6
- class NodeRequest
7
- using Refinements::ArrayExtensions
8
-
9
- # Number of processors usable by job
10
- # @return [Fixnum, nil] number of procs
11
- attr_reader :procs
12
-
13
- # List of properties required by job
14
- # @return [Array<String>, nil] list of properties
15
- attr_reader :properties
16
-
17
- # @param procs [#to_i, nil] number of procs
18
- # @param properties [#to_s, Array<#to_s>, nil] list of properties
19
- def initialize(procs: nil, properties: nil, **_)
20
- @procs = procs && procs.to_i
21
- @properties = properties && Array.wrap(properties).map(&:to_s)
22
- end
23
-
24
- # Convert object to hash
25
- # @return [Hash] object as hash
26
- def to_h
27
- { procs: procs, properties: properties }
28
- end
29
-
30
- # The comparison operator
31
- # @param other [#to_h] object to compare against
32
- # @return [Boolean] whether objects are equivalent
33
- def ==(other)
34
- to_h == other.to_h
35
- end
36
-
37
- # Whether objects are identical to each other
38
- # @param other [#to_h] object to compare against
39
- # @return [Boolean] whether objects are identical
40
- def eql?(other)
41
- self.class == other.class && self == other
42
- end
43
-
44
- # Generate a hash value for this object
45
- # @return [Fixnum] hash value of object
46
- def hash
47
- [self.class, to_h].hash
48
- end
49
- end
50
- end
51
- end