ood_core 0.22.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 +4 -4
 - data/CHANGELOG.md +27 -1
 - data/lib/ood_core/data_formatter.rb +14 -0
 - data/lib/ood_core/job/account_info.rb +38 -0
 - data/lib/ood_core/job/adapter.rb +16 -0
 - data/lib/ood_core/job/adapters/linux_host/launcher.rb +1 -1
 - data/lib/ood_core/job/adapters/slurm.rb +64 -1
 - data/lib/ood_core/job/queue_info.rb +45 -0
 - data/lib/ood_core/job/script.rb +1 -0
 - data/lib/ood_core/version.rb +1 -1
 - data/lib/ood_core.rb +3 -0
 - metadata +5 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bd8cb5dc98cf0b2c2120fdb6234e5482fb40cbec59f6688318e0d33b050d0dc4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0fe72b2fe29aa1e4ca2d5e28ca43e8b3f9e0381fe17f4678ea7218a5c062a3e7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 53bd81e896ae96b55e92732b86d9ca364449f8140bedbaba0b6fc9de73d5ffb06e65ea9ba84cc84e621bbf64af5b30a241a803b7fb4944745ebb50cc2a6ba39f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9106dbc505aff7040bedeba9c0531cd539dbcd11e3aac54072e7bc01660f8f07147fb19be325631496215b6c1725bb68ca57968b39e377b0567747ef5569563c
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -7,6 +7,30 @@ 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 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ## [0.23.0] - 01-17-2023
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            - [787](https://github.com/OSC/ood_core/pull/787) added the `queues` API to the adapter class with
         
     | 
| 
      
 25 
     | 
    
         
            +
              support for Slurm.
         
     | 
| 
      
 26 
     | 
    
         
            +
            - [783](https://github.com/OSC/ood_core/pull/783) added the `accounts` API to the adapter class with
         
     | 
| 
      
 27 
     | 
    
         
            +
              support for Slurm.
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            - The linux host adapter now supports apptainer in [788](https://github.com/OSC/ood_core/pull/788).
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       10 
34 
     | 
    
         
             
            ## [0.22.0] - 10-31-2022
         
     | 
| 
       11 
35 
     | 
    
         | 
| 
       12 
36 
     | 
    
         
             
            ### Added
         
     | 
| 
         @@ -455,7 +479,9 @@ Functionally the same as [0.17.3] but with some CI updates. 
     | 
|
| 
       455 
479 
     | 
    
         
             
            ### Added
         
     | 
| 
       456 
480 
     | 
    
         
             
            - Initial release!
         
     | 
| 
       457 
481 
     | 
    
         | 
| 
       458 
     | 
    
         
            -
            [Unreleased]: https://github.com/OSC/ood_core/compare/v0. 
     | 
| 
      
 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
         
     | 
| 
      
 484 
     | 
    
         
            +
            [0.23.0]: https://github.com/OSC/ood_core/compare/v0.22.0...v0.23.0
         
     | 
| 
       459 
485 
     | 
    
         
             
            [0.22.0]: https://github.com/OSC/ood_core/compare/v0.21.0...v0.22.0
         
     | 
| 
       460 
486 
     | 
    
         
             
            [0.21.0]: https://github.com/OSC/ood_core/compare/v0.20.2...v0.21.0
         
     | 
| 
       461 
487 
     | 
    
         
             
            [0.20.2]: https://github.com/OSC/ood_core/compare/v0.20.1...v0.20.2
         
     | 
| 
         @@ -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
         
     | 
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module OodCore
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Job
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                class AccountInfo
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  include OodCore::DataFormatter
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  # The name of the account.
         
     | 
| 
      
 9 
     | 
    
         
            +
                  attr_reader :name
         
     | 
| 
      
 10 
     | 
    
         
            +
                  alias to_s name
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  # The QoS values this account can use.
         
     | 
| 
      
 13 
     | 
    
         
            +
                  attr_reader :qos
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  # The cluster this account is associated with.
         
     | 
| 
      
 16 
     | 
    
         
            +
                  attr_reader :cluster
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  # The queue this account can use. nil means there is no queue info
         
     | 
| 
      
 19 
     | 
    
         
            +
                  # for this account.
         
     | 
| 
      
 20 
     | 
    
         
            +
                  attr_reader :queue
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def initialize(**opts)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    orig_name = opts.fetch(:name, 'unknown')
         
     | 
| 
      
 24 
     | 
    
         
            +
                    @name = upcase_accounts? ? orig_name.upcase : orig_name
         
     | 
| 
      
 25 
     | 
    
         
            +
                    @qos = opts.fetch(:qos, [])
         
     | 
| 
      
 26 
     | 
    
         
            +
                    @cluster = opts.fetch(:cluster, nil)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @queue = opts.fetch(:queue, nil)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def to_h
         
     | 
| 
      
 31 
     | 
    
         
            +
                    instance_variables.map do |var|
         
     | 
| 
      
 32 
     | 
    
         
            +
                      name = var.to_s.gsub('@', '').to_sym
         
     | 
| 
      
 33 
     | 
    
         
            +
                      [name, send(name)]
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end.to_h
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/ood_core/job/adapter.rb
    CHANGED
    
    | 
         @@ -197,6 +197,22 @@ module OodCore 
     | 
|
| 
       197 
197 
     | 
    
         
             
                  def job_name_illegal_chars
         
     | 
| 
       198 
198 
     | 
    
         
             
                    ENV["OOD_JOB_NAME_ILLEGAL_CHARS"].to_s
         
     | 
| 
       199 
199 
     | 
    
         
             
                  end
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                  # Retrieve the accounts available to use  for the current user.
         
     | 
| 
      
 202 
     | 
    
         
            +
                  #
         
     | 
| 
      
 203 
     | 
    
         
            +
                  # Subclasses that do not implement this will return empty arrays.
         
     | 
| 
      
 204 
     | 
    
         
            +
                  # @return [Array<AccountInfo>] the accounts available to the user.
         
     | 
| 
      
 205 
     | 
    
         
            +
                  def accounts
         
     | 
| 
      
 206 
     | 
    
         
            +
                    []
         
     | 
| 
      
 207 
     | 
    
         
            +
                  end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                  # Return the list of queues for this scheduler.
         
     | 
| 
      
 210 
     | 
    
         
            +
                  #
         
     | 
| 
      
 211 
     | 
    
         
            +
                  # Subclasses that do not implement this will return empty arrays.
         
     | 
| 
      
 212 
     | 
    
         
            +
                  # @return [Array<QueueInfo>]
         
     | 
| 
      
 213 
     | 
    
         
            +
                  def queues
         
     | 
| 
      
 214 
     | 
    
         
            +
                    []
         
     | 
| 
      
 215 
     | 
    
         
            +
                  end
         
     | 
| 
       200 
216 
     | 
    
         
             
                end
         
     | 
| 
       201 
217 
     | 
    
         
             
              end
         
     | 
| 
       202 
218 
     | 
    
         
             
            end
         
     | 
| 
         @@ -73,7 +73,7 @@ class OodCore::Job::Adapters::LinuxHost::Launcher 
     | 
|
| 
       73 
73 
     | 
    
         
             
                # Get the tmux pane PID for the target session
         
     | 
| 
       74 
74 
     | 
    
         
             
                pane_pid=$(tmux list-panes -aF '\#{session_name} \#{pane_pid}' | grep '#{session_name}' | cut -f 2 -d ' ')
         
     | 
| 
       75 
75 
     | 
    
         
             
                # Find the Singularity sinit PID child of the pane process
         
     | 
| 
       76 
     | 
    
         
            -
                pane_sinit_pid=$(pstree -p -l "$pane_pid" | egrep -o 'sinit[(][[:digit:]]*|shim-init[(][[:digit:]] 
     | 
| 
      
 76 
     | 
    
         
            +
                pane_sinit_pid=$(pstree -p -l "$pane_pid" | egrep -o 'sinit[(][[:digit:]]*|shim-init[(][[:digit:]]|appinit[(][[:digit:]]' | grep -o '[[:digit:]]*')
         
     | 
| 
       77 
77 
     | 
    
         
             
                # Kill sinit which stops both Singularity-based processes and the tmux session
         
     | 
| 
       78 
78 
     | 
    
         
             
                kill "$pane_sinit_pid"
         
     | 
| 
       79 
79 
     | 
    
         
             
                SCRIPT
         
     | 
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "time"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'etc'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require "ood_core/refinements/hash_extensions"
         
     | 
| 
       3 
4 
     | 
    
         
             
            require "ood_core/refinements/array_extensions"
         
     | 
| 
       4 
5 
     | 
    
         
             
            require "ood_core/job/adapters/helper"
         
     | 
| 
         @@ -178,6 +179,27 @@ module OodCore 
     | 
|
| 
       178 
179 
     | 
    
         
             
                        return [{ id: id, state: 'undetermined' }]
         
     | 
| 
       179 
180 
     | 
    
         
             
                      end
         
     | 
| 
       180 
181 
     | 
    
         | 
| 
      
 182 
     | 
    
         
            +
                      def accounts
         
     | 
| 
      
 183 
     | 
    
         
            +
                        user = Etc.getlogin
         
     | 
| 
      
 184 
     | 
    
         
            +
                        args = ['-nP', 'show', 'users', 'withassoc', 'format=account,cluster,partition,qos', 'where', "user=#{user}"]
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                        [].tap do |accts|
         
     | 
| 
      
 187 
     | 
    
         
            +
                          call('sacctmgr', *args).each_line do |line|
         
     | 
| 
      
 188 
     | 
    
         
            +
                            acct, cluster, queue, qos = line.split('|')
         
     | 
| 
      
 189 
     | 
    
         
            +
                            next if acct.nil? || acct.chomp.empty?
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                            args = {
         
     | 
| 
      
 192 
     | 
    
         
            +
                              name: acct,
         
     | 
| 
      
 193 
     | 
    
         
            +
                              qos: qos.to_s.chomp.split(','),
         
     | 
| 
      
 194 
     | 
    
         
            +
                              cluster: cluster,
         
     | 
| 
      
 195 
     | 
    
         
            +
                              queue: queue.to_s.empty? ? nil : queue
         
     | 
| 
      
 196 
     | 
    
         
            +
                            }
         
     | 
| 
      
 197 
     | 
    
         
            +
                            info = OodCore::Job::AccountInfo.new(**args) unless acct.nil?
         
     | 
| 
      
 198 
     | 
    
         
            +
                            accts << info unless acct.nil?
         
     | 
| 
      
 199 
     | 
    
         
            +
                          end
         
     | 
| 
      
 200 
     | 
    
         
            +
                        end
         
     | 
| 
      
 201 
     | 
    
         
            +
                      end
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
       181 
203 
     | 
    
         
             
                      def squeue_fields(attrs)
         
     | 
| 
       182 
204 
     | 
    
         
             
                        if attrs.nil?
         
     | 
| 
       183 
205 
     | 
    
         
             
                          all_squeue_fields
         
     | 
| 
         @@ -300,7 +322,37 @@ module OodCore 
     | 
|
| 
       300 
322 
     | 
    
         
             
                        }
         
     | 
| 
       301 
323 
     | 
    
         
             
                      end
         
     | 
| 
       302 
324 
     | 
    
         | 
| 
      
 325 
     | 
    
         
            +
                      def queues
         
     | 
| 
      
 326 
     | 
    
         
            +
                        info_raw = call('scontrol', 'show', 'part', '-o')
         
     | 
| 
      
 327 
     | 
    
         
            +
             
     | 
| 
      
 328 
     | 
    
         
            +
                        [].tap do |ret_arr|
         
     | 
| 
      
 329 
     | 
    
         
            +
                          info_raw.each_line do |line|
         
     | 
| 
      
 330 
     | 
    
         
            +
                            ret_arr << str_to_acct_info(line)
         
     | 
| 
      
 331 
     | 
    
         
            +
                          end
         
     | 
| 
      
 332 
     | 
    
         
            +
                        end
         
     | 
| 
      
 333 
     | 
    
         
            +
                      end
         
     | 
| 
      
 334 
     | 
    
         
            +
             
     | 
| 
       303 
335 
     | 
    
         
             
                      private
         
     | 
| 
      
 336 
     | 
    
         
            +
                        def str_to_acct_info(line)
         
     | 
| 
      
 337 
     | 
    
         
            +
                          hsh = line.split(' ').map do |token|
         
     | 
| 
      
 338 
     | 
    
         
            +
                            m = token.match(/^(?<key>\w+)=(?<value>.+)$/)
         
     | 
| 
      
 339 
     | 
    
         
            +
                            [m[:key], m[:value]]
         
     | 
| 
      
 340 
     | 
    
         
            +
                          end.to_h.symbolize_keys
         
     | 
| 
      
 341 
     | 
    
         
            +
             
     | 
| 
      
 342 
     | 
    
         
            +
                          hsh[:name] = hsh[:PartitionName]
         
     | 
| 
      
 343 
     | 
    
         
            +
                          hsh[:qos] =  hsh[:QoS].to_s == 'N/A' ? [] : hsh[:QoS].to_s.split(',')
         
     | 
| 
      
 344 
     | 
    
         
            +
                          hsh[:allow_accounts] = if hsh[:AllowAccounts].nil? || hsh[:AllowAccounts].to_s == 'ALL'
         
     | 
| 
      
 345 
     | 
    
         
            +
                                                   nil
         
     | 
| 
      
 346 
     | 
    
         
            +
                                                 else
         
     | 
| 
      
 347 
     | 
    
         
            +
                                                   hsh[:AllowAccounts].to_s.split(',')
         
     | 
| 
      
 348 
     | 
    
         
            +
                                                 end
         
     | 
| 
      
 349 
     | 
    
         
            +
             
     | 
| 
      
 350 
     | 
    
         
            +
             
     | 
| 
      
 351 
     | 
    
         
            +
                          hsh[:deny_accounts] = hsh[:DenyAccounts].nil? ? [] : hsh[:DenyAccounts].to_s.split(',')
         
     | 
| 
      
 352 
     | 
    
         
            +
             
     | 
| 
      
 353 
     | 
    
         
            +
                          OodCore::Job::QueueInfo.new(**hsh)
         
     | 
| 
      
 354 
     | 
    
         
            +
                        end
         
     | 
| 
      
 355 
     | 
    
         
            +
             
     | 
| 
       304 
356 
     | 
    
         
             
                        # Modify the StringIO instance by advancing past the squeue header
         
     | 
| 
       305 
357 
     | 
    
         
             
                        #
         
     | 
| 
       306 
358 
     | 
    
         
             
                        # The first two "records" should always be discarded. Consider the
         
     | 
| 
         @@ -325,7 +377,7 @@ module OodCore 
     | 
|
| 
       325 
377 
     | 
    
         
             
                          cmd = OodCore::Job::Adapters::Helper.bin_path(cmd, bin, bin_overrides)
         
     | 
| 
       326 
378 
     | 
    
         | 
| 
       327 
379 
     | 
    
         
             
                          args  = args.map(&:to_s)
         
     | 
| 
       328 
     | 
    
         
            -
                          args.concat ["-M", cluster] if cluster
         
     | 
| 
      
 380 
     | 
    
         
            +
                          args.concat ["-M", cluster] if cluster && cmd != 'sacctmgr'
         
     | 
| 
       329 
381 
     | 
    
         | 
| 
       330 
382 
     | 
    
         
             
                          env = env.to_h
         
     | 
| 
       331 
383 
     | 
    
         
             
                          env["SLURM_CONF"] = conf.to_s if conf
         
     | 
| 
         @@ -483,6 +535,13 @@ module OodCore 
     | 
|
| 
       483 
535 
     | 
    
         
             
                      @slurm.get_cluster_info
         
     | 
| 
       484 
536 
     | 
    
         
             
                    end
         
     | 
| 
       485 
537 
     | 
    
         | 
| 
      
 538 
     | 
    
         
            +
                    # Retrieve the accounts available to use  for the current user.
         
     | 
| 
      
 539 
     | 
    
         
            +
                    #
         
     | 
| 
      
 540 
     | 
    
         
            +
                    # @return [Array<String>] the accounts available to the user.
         
     | 
| 
      
 541 
     | 
    
         
            +
                    def accounts
         
     | 
| 
      
 542 
     | 
    
         
            +
                      @slurm.accounts
         
     | 
| 
      
 543 
     | 
    
         
            +
                    end
         
     | 
| 
      
 544 
     | 
    
         
            +
             
     | 
| 
       486 
545 
     | 
    
         
             
                    # Retrieve info for all jobs from the resource manager
         
     | 
| 
       487 
546 
     | 
    
         
             
                    # @raise [JobAdapterError] if something goes wrong getting job info
         
     | 
| 
       488 
547 
     | 
    
         
             
                    # @return [Array<Info>] information describing submitted jobs
         
     | 
| 
         @@ -605,6 +664,10 @@ module OodCore 
     | 
|
| 
       605 
664 
     | 
    
         
             
                      '#SBATCH'
         
     | 
| 
       606 
665 
     | 
    
         
             
                    end
         
     | 
| 
       607 
666 
     | 
    
         | 
| 
      
 667 
     | 
    
         
            +
                    def queues
         
     | 
| 
      
 668 
     | 
    
         
            +
                      @slurm.queues
         
     | 
| 
      
 669 
     | 
    
         
            +
                    end
         
     | 
| 
      
 670 
     | 
    
         
            +
             
     | 
| 
       608 
671 
     | 
    
         
             
                    private
         
     | 
| 
       609 
672 
     | 
    
         
             
                      # Convert duration to seconds
         
     | 
| 
       610 
673 
     | 
    
         
             
                      def duration_in_seconds(time)
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # QueueInfo is information about a given queue on a scheduler.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class OodCore::Job::QueueInfo
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              include OodCore::DataFormatter
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              # The name of the queue.
         
     | 
| 
      
 9 
     | 
    
         
            +
              attr_reader :name
         
     | 
| 
      
 10 
     | 
    
         
            +
              alias to_s name
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              # The QoSes associated with this queue
         
     | 
| 
      
 13 
     | 
    
         
            +
              attr_reader :qos
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              # The accounts that are allowed to use this queue.
         
     | 
| 
      
 16 
     | 
    
         
            +
              #
         
     | 
| 
      
 17 
     | 
    
         
            +
              # nil means ALL accounts are allowed.
         
     | 
| 
      
 18 
     | 
    
         
            +
              attr_reader :allow_accounts
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              # The accounts that are not allowed to use this queue.
         
     | 
| 
      
 21 
     | 
    
         
            +
              attr_reader :deny_accounts
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def initialize(**opts)
         
     | 
| 
      
 24 
     | 
    
         
            +
                @name = opts.fetch(:name, 'unknown')
         
     | 
| 
      
 25 
     | 
    
         
            +
                @qos = opts.fetch(:qos, [])
         
     | 
| 
      
 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
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              def to_h
         
     | 
| 
      
 40 
     | 
    
         
            +
                instance_variables.map do |var|
         
     | 
| 
      
 41 
     | 
    
         
            +
                  name = var.to_s.gsub('@', '').to_sym
         
     | 
| 
      
 42 
     | 
    
         
            +
                  [name, send(name)]
         
     | 
| 
      
 43 
     | 
    
         
            +
                end.to_h
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/ood_core/job/script.rb
    CHANGED
    
    
    
        data/lib/ood_core/version.rb
    CHANGED
    
    
    
        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
         
     | 
| 
         @@ -12,6 +13,8 @@ module OodCore 
     | 
|
| 
       12 
13 
     | 
    
         
             
                require "ood_core/job/script"
         
     | 
| 
       13 
14 
     | 
    
         
             
                require "ood_core/job/info"
         
     | 
| 
       14 
15 
     | 
    
         
             
                require "ood_core/job/cluster_info"
         
     | 
| 
      
 16 
     | 
    
         
            +
                require "ood_core/job/account_info"
         
     | 
| 
      
 17 
     | 
    
         
            +
                require "ood_core/job/queue_info"
         
     | 
| 
       15 
18 
     | 
    
         
             
                require "ood_core/job/status"
         
     | 
| 
       16 
19 
     | 
    
         
             
                require "ood_core/job/adapter"
         
     | 
| 
       17 
20 
     | 
    
         
             
                require "ood_core/job/factory"
         
     | 
    
        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.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:  
     | 
| 
      
 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,8 +176,10 @@ 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
         
     | 
| 
      
 182 
     | 
    
         
            +
            - lib/ood_core/job/account_info.rb
         
     | 
| 
       181 
183 
     | 
    
         
             
            - lib/ood_core/job/adapter.rb
         
     | 
| 
       182 
184 
     | 
    
         
             
            - lib/ood_core/job/adapters/ccq.rb
         
     | 
| 
       183 
185 
     | 
    
         
             
            - lib/ood_core/job/adapters/drmaa.rb
         
     | 
| 
         @@ -217,6 +219,7 @@ files: 
     | 
|
| 
       217 
219 
     | 
    
         
             
            - lib/ood_core/job/factory.rb
         
     | 
| 
       218 
220 
     | 
    
         
             
            - lib/ood_core/job/info.rb
         
     | 
| 
       219 
221 
     | 
    
         
             
            - lib/ood_core/job/node_info.rb
         
     | 
| 
      
 222 
     | 
    
         
            +
            - lib/ood_core/job/queue_info.rb
         
     | 
| 
       220 
223 
     | 
    
         
             
            - lib/ood_core/job/script.rb
         
     | 
| 
       221 
224 
     | 
    
         
             
            - lib/ood_core/job/status.rb
         
     | 
| 
       222 
225 
     | 
    
         
             
            - lib/ood_core/job/task.rb
         
     |