ood_core 0.23.0 → 0.23.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 379d230153e94bdbeca027f601afc89a525b328d8e200cc1a6a18754b3370b88
4
- data.tar.gz: 5544e85c81b6e955a63144a056eee24d6bd5ec062de4d17a535d9df78eb5a817
3
+ metadata.gz: bd8cb5dc98cf0b2c2120fdb6234e5482fb40cbec59f6688318e0d33b050d0dc4
4
+ data.tar.gz: 0fe72b2fe29aa1e4ca2d5e28ca43e8b3f9e0381fe17f4678ea7218a5c062a3e7
5
5
  SHA512:
6
- metadata.gz: 972cabe2a634f50b730e29d31a54e34c2784ea707fd562b867c8f8731e4d612bd39fd8bcacb84b49585a08131d4f9e3770195f2c1c6036fde52ff4e3d4f7124c
7
- data.tar.gz: 4a0997de2400017ad8a921358b76341706cd4e58034c881dd8b9dfe63e9d9b7c559c42ed711a13051cd5168dde6703164714d22ee1e8ae2d7980fa33d2da3e4c
6
+ metadata.gz: 53bd81e896ae96b55e92732b86d9ca364449f8140bedbaba0b6fc9de73d5ffb06e65ea9ba84cc84e621bbf64af5b30a241a803b7fb4944745ebb50cc2a6ba39f
7
+ data.tar.gz: 9106dbc505aff7040bedeba9c0531cd539dbcd11e3aac54072e7bc01660f8f07147fb19be325631496215b6c1725bb68ca57968b39e377b0567747ef5569563c
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.23.1] - 02-01-2023
11
+
12
+ ### Fixed
13
+
14
+ - `QueueInfo` objects also upcase accounts when applicable in [792](https://github.com/OSC/ood_core/pull/792).
15
+
16
+ ### Added
17
+
18
+ - `queue_name` has the alias `queue` in [790](https://github.com/OSC/ood_core/pull/790).
19
+
10
20
  ## [0.23.0] - 01-17-2023
11
21
 
12
22
  ### Added
@@ -469,7 +479,8 @@ Functionally the same as [0.17.3] but with some CI updates.
469
479
  ### Added
470
480
  - Initial release!
471
481
 
472
- [Unreleased]: https://github.com/OSC/ood_core/compare/v0.23.0...HEAD
482
+ [Unreleased]: https://github.com/OSC/ood_core/compare/v0.23.1...HEAD
483
+ [0.23.1]: https://github.com/OSC/ood_core/compare/v0.22.0...v0.23.0
473
484
  [0.23.0]: https://github.com/OSC/ood_core/compare/v0.22.0...v0.23.0
474
485
  [0.22.0]: https://github.com/OSC/ood_core/compare/v0.21.0...v0.22.0
475
486
  [0.21.0]: https://github.com/OSC/ood_core/compare/v0.20.2...v0.21.0
@@ -0,0 +1,14 @@
1
+ module OodCore
2
+ module DataFormatter
3
+ # Determine whether to upcase account strings when returning adapter#accounts
4
+ def upcase_accounts?
5
+ env_var = ENV['OOD_UPCASE_ACCOUNTS']
6
+
7
+ if env_var.nil? || env_var.to_s.downcase == 'false'
8
+ false
9
+ else
10
+ true
11
+ end
12
+ end
13
+ end
14
+ end
@@ -3,6 +3,8 @@ module OodCore
3
3
 
4
4
  class AccountInfo
5
5
 
6
+ include OodCore::DataFormatter
7
+
6
8
  # The name of the account.
7
9
  attr_reader :name
8
10
  alias to_s name
@@ -19,7 +21,7 @@ module OodCore
19
21
 
20
22
  def initialize(**opts)
21
23
  orig_name = opts.fetch(:name, 'unknown')
22
- @name = OodCore::Job::Adapters::Helper.upcase_accounts? ? orig_name.upcase : orig_name
24
+ @name = upcase_accounts? ? orig_name.upcase : orig_name
23
25
  @qos = opts.fetch(:qos, [])
24
26
  @cluster = opts.fetch(:cluster, nil)
25
27
  @queue = opts.fetch(:queue, nil)
@@ -31,17 +31,6 @@ module OodCore
31
31
 
32
32
  return 'ssh', args + [cmd] + cmd_args
33
33
  end
34
-
35
- # Determine whether to upcase account strings when returning adapter#accounts
36
- def self.upcase_accounts?
37
- env_var = ENV['OOD_UPCASE_ACCOUNTS']
38
-
39
- if env_var.nil? || env_var.to_s.downcase == 'false'
40
- false
41
- else
42
- true
43
- end
44
- end
45
34
  end
46
35
  end
47
36
  end
@@ -186,13 +186,13 @@ module OodCore
186
186
  [].tap do |accts|
187
187
  call('sacctmgr', *args).each_line do |line|
188
188
  acct, cluster, queue, qos = line.split('|')
189
- next if acct.nil?
189
+ next if acct.nil? || acct.chomp.empty?
190
190
 
191
191
  args = {
192
192
  name: acct,
193
193
  qos: qos.to_s.chomp.split(','),
194
194
  cluster: cluster,
195
- queue: queue.empty? ? nil : queue
195
+ queue: queue.to_s.empty? ? nil : queue
196
196
  }
197
197
  info = OodCore::Job::AccountInfo.new(**args) unless acct.nil?
198
198
  accts << info unless acct.nil?
@@ -2,6 +2,9 @@
2
2
 
3
3
  # QueueInfo is information about a given queue on a scheduler.
4
4
  class OodCore::Job::QueueInfo
5
+
6
+ include OodCore::DataFormatter
7
+
5
8
  # The name of the queue.
6
9
  attr_reader :name
7
10
  alias to_s name
@@ -20,8 +23,17 @@ class OodCore::Job::QueueInfo
20
23
  def initialize(**opts)
21
24
  @name = opts.fetch(:name, 'unknown')
22
25
  @qos = opts.fetch(:qos, [])
23
- @allow_accounts = opts.fetch(:allow_accounts, nil)
24
- @deny_accounts = opts.fetch(:deny_accounts, [])
26
+
27
+ allow_accounts = opts.fetch(:allow_accounts, nil)
28
+ @allow_accounts = if allow_accounts.nil?
29
+ nil
30
+ else
31
+ allow_accounts.compact.map { |acct| upcase_accounts? ? acct.to_s.upcase : acct }
32
+ end
33
+
34
+ @deny_accounts = opts.fetch(:deny_accounts, []).compact.map do |acct|
35
+ upcase_accounts? ? acct.to_s.upcase : acct
36
+ end
25
37
  end
26
38
 
27
39
  def to_h
@@ -77,6 +77,7 @@ module OodCore
77
77
  # Name of the queue the job should be submitted to
78
78
  # @return [String, nil] queue name
79
79
  attr_reader :queue_name
80
+ alias queue queue_name
80
81
 
81
82
  # The scheduling priority for the job
82
83
  # @return [Integer, nil] scheduling priority
@@ -1,4 +1,4 @@
1
1
  module OodCore
2
2
  # The current version of {OodCore}
3
- VERSION = "0.23.0"
3
+ VERSION = "0.23.1"
4
4
  end
data/lib/ood_core.rb CHANGED
@@ -3,6 +3,7 @@ require "ood_core/errors"
3
3
  require "ood_core/cluster"
4
4
  require "ood_core/clusters"
5
5
  require "ood_core/invalid_cluster"
6
+ require "ood_core/data_formatter"
6
7
 
7
8
  # The main namespace for ood_core
8
9
  module OodCore
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.23.0
4
+ version: 0.23.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: 2023-01-18 00:00:00.000000000 Z
13
+ date: 2023-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ood_support
@@ -176,6 +176,7 @@ files:
176
176
  - lib/ood_core/batch_connect/templates/vnc_container.rb
177
177
  - lib/ood_core/cluster.rb
178
178
  - lib/ood_core/clusters.rb
179
+ - lib/ood_core/data_formatter.rb
179
180
  - lib/ood_core/errors.rb
180
181
  - lib/ood_core/invalid_cluster.rb
181
182
  - lib/ood_core/job/account_info.rb