ood_core 0.6.0 → 0.7.0
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 +1 -1
 - data/CHANGELOG.md +16 -1
 - data/lib/ood_core/job/adapters/sge/batch.rb +25 -12
 - data/lib/ood_core/job/adapters/torque/batch.rb +7 -7
 - data/lib/ood_core/job/adapters/torque/ffi.rb +2 -1
 - data/lib/ood_core/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 948be1edf24a4e534669547d92b6ad56cc229183442a27705941bd959085a09a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 700a6c5073641233ac36553350d4ab451e0b01d73f885bc7bd2695b81479b6fa
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fcc1aa968fe78132164a5ba3ab6e6165f1f64b950ca1e3862b00020aec9915c1458e52897005a0057b6ca4d9205c3b463f8f9b421e85f9da75778fe27734b371
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 74af322ccb4e8f50c350d190bacc65440fb3ab79791a4cb03f5d081131a0d72ad186f43b647621d57053f4da717a59cd9efae9f8cb7c6c377b34ec4563faf100
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -6,6 +6,20 @@ 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 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ## [0.7.0] - 2018-12-26
         
     | 
| 
      
 11 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Addition of an optional live system test of a configurable job adapter
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 15 
     | 
    
         
            +
            - Fix Torque adapter crash by fixing scope resolution on Attrl and Attropl
         
     | 
| 
      
 16 
     | 
    
         
            +
            - Fix SGE adapter crash in `OodCore::Job::Adapters::Sge::Batch#get_info_enqueued_job` when libdrmma is not available (DRMMA constant not defined)
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 19 
     | 
    
         
            +
            - Always set `SGE_ROOT` env var, for both SGE commands via popen and when using libdrmaa
         
     | 
| 
      
 20 
     | 
    
         
            +
            - Use libdrmaa only when libdrmaa is set in the cluster config
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       9 
23 
     | 
    
         
             
            ## [0.6.0] - 2018-12-19
         
     | 
| 
       10 
24 
     | 
    
         
             
            ### Added
         
     | 
| 
       11 
25 
     | 
    
         
             
            - Added ability to override the default password length
         
     | 
| 
         @@ -139,7 +153,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. 
     | 
|
| 
       139 
153 
     | 
    
         
             
            ### Added
         
     | 
| 
       140 
154 
     | 
    
         
             
            - Initial release!
         
     | 
| 
       141 
155 
     | 
    
         | 
| 
       142 
     | 
    
         
            -
            [Unreleased]: https://github.com/OSC/ood_core/compare/v0. 
     | 
| 
      
 156 
     | 
    
         
            +
            [Unreleased]: https://github.com/OSC/ood_core/compare/v0.7.0...HEAD
         
     | 
| 
      
 157 
     | 
    
         
            +
            [0.7.0]: https://github.com/OSC/ood_core/compare/v0.6.0...v0.7.0
         
     | 
| 
       143 
158 
     | 
    
         
             
            [0.6.0]: https://github.com/OSC/ood_core/compare/v0.5.1...v0.6.0
         
     | 
| 
       144 
159 
     | 
    
         
             
            [0.5.1]: https://github.com/OSC/ood_core/compare/v0.5.0...v0.5.1
         
     | 
| 
       145 
160 
     | 
    
         
             
            [0.5.0]: https://github.com/OSC/ood_core/compare/v0.4.0...v0.5.0
         
     | 
| 
         @@ -15,7 +15,7 @@ end 
     | 
|
| 
       15 
15 
     | 
    
         
             
            class OodCore::Job::Adapters::Sge::Batch
         
     | 
| 
       16 
16 
     | 
    
         
             
              using OodCore::Refinements::HashExtensions
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              attr_reader :bin, :bin_overrides, :conf, :cluster, : 
     | 
| 
      
 18 
     | 
    
         
            +
              attr_reader :bin, :bin_overrides, :conf, :cluster, :helper
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              require "ood_core/job/adapters/sge/qstat_xml_j_r_listener"
         
     | 
| 
       21 
21 
     | 
    
         
             
              require "ood_core/job/adapters/sge/qstat_xml_r_listener"
         
     | 
| 
         @@ -23,6 +23,7 @@ class OodCore::Job::Adapters::Sge::Batch 
     | 
|
| 
       23 
23 
     | 
    
         
             
              require "ood_core/job/adapters/helper"
         
     | 
| 
       24 
24 
     | 
    
         
             
              require 'time'
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       26 
27 
     | 
    
         
             
              class Error < StandardError; end
         
     | 
| 
       27 
28 
     | 
    
         | 
| 
       28 
29 
     | 
    
         
             
              # @param opts [#to_h] the options defining this adapter
         
     | 
| 
         @@ -34,10 +35,18 @@ class OodCore::Job::Adapters::Sge::Batch 
     | 
|
| 
       34 
35 
     | 
    
         
             
                @cluster          = config.fetch(:cluster, nil)
         
     | 
| 
       35 
36 
     | 
    
         
             
                @conf             = Pathname.new(config.fetch(:conf, nil))
         
     | 
| 
       36 
37 
     | 
    
         
             
                @bin              = Pathname.new(config.fetch(:bin, nil))
         
     | 
| 
       37 
     | 
    
         
            -
                @sge_root         =  
     | 
| 
      
 38 
     | 
    
         
            +
                @sge_root         = Pathname.new(config[:sge_root] || ENV['SGE_ROOT'] || "/var/lib/gridengine")
         
     | 
| 
       38 
39 
     | 
    
         
             
                @bin_overrides    = config.fetch(:bin_overrides, {})
         
     | 
| 
       39 
40 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                 
     | 
| 
      
 41 
     | 
    
         
            +
                # FIXME: hack as this affects env of the process!
         
     | 
| 
      
 42 
     | 
    
         
            +
                ENV['SGE_ROOT'] = @sge_root.to_s
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                if config[:libdrmaa_path]
         
     | 
| 
      
 45 
     | 
    
         
            +
                  load_drmaa(config[:libdrmaa_path])
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @can_use_drmaa    = true
         
     | 
| 
      
 47 
     | 
    
         
            +
                else
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @can_use_drmaa    = false
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
       41 
50 
     | 
    
         | 
| 
       42 
51 
     | 
    
         
             
                @helper = OodCore::Job::Adapters::Sge::Helper.new
         
     | 
| 
       43 
52 
     | 
    
         
             
              end
         
     | 
| 
         @@ -62,7 +71,7 @@ class OodCore::Job::Adapters::Sge::Batch 
     | 
|
| 
       62 
71 
     | 
    
         | 
| 
       63 
72 
     | 
    
         
             
              # Get OodCore::Job::Info for a job_id that may still be in the queue
         
     | 
| 
       64 
73 
     | 
    
         
             
              # 
         
     | 
| 
       65 
     | 
    
         
            -
              # If  
     | 
| 
      
 74 
     | 
    
         
            +
              # If libdrmaa is not loaded then we cannot use DRMAA. Using
         
     | 
| 
       66 
75 
     | 
    
         
             
              # DRMAA provides better job status and should always be chosen if it is possible.
         
     | 
| 
       67 
76 
     | 
    
         
             
              # 
         
     | 
| 
       68 
77 
     | 
    
         
             
              # When qstat is called in XML mode for a job id that is not in the queue invalid XML
         
     | 
| 
         @@ -74,30 +83,35 @@ class OodCore::Job::Adapters::Sge::Batch 
     | 
|
| 
       74 
83 
     | 
    
         
             
              def get_info_enqueued_job(job_id)
         
     | 
| 
       75 
84 
     | 
    
         
             
                job_info = OodCore::Job::Info.new(id: job_id.to_s, status: :completed)
         
     | 
| 
       76 
85 
     | 
    
         
             
                argv = ['qstat', '-r', '-xml', '-j', job_id.to_s]
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
       78 
87 
     | 
    
         
             
                begin
         
     | 
| 
       79 
88 
     | 
    
         
             
                  results = call(*argv)
         
     | 
| 
       80 
89 
     | 
    
         
             
                  listener = QstatXmlJRListener.new
         
     | 
| 
       81 
90 
     | 
    
         
             
                  REXML::Parsers::StreamParser.new(results, listener).parse
         
     | 
| 
       82 
91 
     | 
    
         | 
| 
       83 
92 
     | 
    
         
             
                  job_hash = listener.parsed_job
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                  if can_use_drmaa?
         
     | 
| 
      
 95 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 96 
     | 
    
         
            +
                      job_hash[:status] = get_status_from_drmma(job_id)
         
     | 
| 
      
 97 
     | 
    
         
            +
                    rescue DRMAA::DRMAAInvalidArgumentError => e
         
     | 
| 
      
 98 
     | 
    
         
            +
                      raise Error, e.message
         
     | 
| 
      
 99 
     | 
    
         
            +
                    end
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
       86 
102 
     | 
    
         
             
                  job_info = OodCore::Job::Info.new(**job_hash)
         
     | 
| 
       87 
103 
     | 
    
         
             
                rescue REXML::ParseException => e
         
     | 
| 
       88 
104 
     | 
    
         
             
                  # If the error is something other than a job not being found by qstat re-raise the error
         
     | 
| 
       89 
105 
     | 
    
         
             
                  unless results =~ /unknown_jobs/
         
     | 
| 
       90 
106 
     | 
    
         
             
                    raise e, "REXML::ParseException error and command '#{argv.join(' ')}' produced results that didn't contain string 'unknown_jobs'. ParseException: #{e.message}"
         
     | 
| 
       91 
107 
     | 
    
         
             
                  end
         
     | 
| 
       92 
     | 
    
         
            -
                rescue DRMAA::DRMAAInvalidArgumentError => e
         
     | 
| 
       93 
     | 
    
         
            -
                  raise Error, e.message
         
     | 
| 
       94 
108 
     | 
    
         
             
                end
         
     | 
| 
       95 
109 
     | 
    
         | 
| 
       96 
110 
     | 
    
         
             
                job_info
         
     | 
| 
       97 
111 
     | 
    
         
             
              end
         
     | 
| 
       98 
112 
     | 
    
         | 
| 
       99 
113 
     | 
    
         
             
              def can_use_drmaa?
         
     | 
| 
       100 
     | 
    
         
            -
                 
     | 
| 
      
 114 
     | 
    
         
            +
                @can_use_drmaa
         
     | 
| 
       101 
115 
     | 
    
         
             
              end
         
     | 
| 
       102 
116 
     | 
    
         | 
| 
       103 
117 
     | 
    
         
             
              # Call qhold
         
     | 
| 
         @@ -197,7 +211,6 @@ class OodCore::Job::Adapters::Sge::Batch 
     | 
|
| 
       197 
211 
     | 
    
         | 
| 
       198 
212 
     | 
    
         
             
              # Get the job status using DRMAA
         
     | 
| 
       199 
213 
     | 
    
         
             
              def get_status_from_drmma(job_id)
         
     | 
| 
       200 
     | 
    
         
            -
                ENV['SGE_ROOT'] = sge_root.to_s
         
     | 
| 
       201 
214 
     | 
    
         
             
                translate_drmaa_state(DRMAA::SessionSingleton.instance.job_ps(job_id.to_s))
         
     | 
| 
       202 
215 
     | 
    
         
             
              end
         
     | 
| 
       203 
     | 
    
         
            -
            end
         
     | 
| 
      
 216 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'open3'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            class OodCore::Job::Adapters::Torque
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              # Object used for simplified communication with a batch server
         
     | 
| 
      
 5 
     | 
    
         
            +
              class Batch
         
     | 
| 
       6 
6 
     | 
    
         
             
                # The host of the Torque batch server
         
     | 
| 
       7 
7 
     | 
    
         
             
                # @example OSC's Oakley batch server
         
     | 
| 
       8 
8 
     | 
    
         
             
                #   my_conn.host #=> "oak-batch.osc.edu"
         
     | 
| 
         @@ -99,7 +99,7 @@ class OodCore::Job::Adapters::Torque 
     | 
|
| 
       99 
99 
     | 
    
         
             
                # @return [Hash] status info for batch server
         
     | 
| 
       100 
100 
     | 
    
         
             
                def get_status(filters: [])
         
     | 
| 
       101 
101 
     | 
    
         
             
                  connect do |cid|
         
     | 
| 
       102 
     | 
    
         
            -
                    filters = Attrl.from_list filters
         
     | 
| 
      
 102 
     | 
    
         
            +
                    filters = FFI::Attrl.from_list filters
         
     | 
| 
       103 
103 
     | 
    
         
             
                    batch_status = FFI.pbs_statserver cid, filters, nil
         
     | 
| 
       104 
104 
     | 
    
         
             
                    batch_status.to_h.tap { FFI.pbs_statfree batch_status }
         
     | 
| 
       105 
105 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -125,7 +125,7 @@ class OodCore::Job::Adapters::Torque 
     | 
|
| 
       125 
125 
     | 
    
         
             
                # @return [Hash] hash of details for the queues
         
     | 
| 
       126 
126 
     | 
    
         
             
                def get_queues(id: '', filters: [])
         
     | 
| 
       127 
127 
     | 
    
         
             
                  connect do |cid|
         
     | 
| 
       128 
     | 
    
         
            -
                    filters = Attrl.from_list(filters)
         
     | 
| 
      
 128 
     | 
    
         
            +
                    filters = FFI::Attrl.from_list(filters)
         
     | 
| 
       129 
129 
     | 
    
         
             
                    batch_status = FFI.pbs_statque cid, id.to_s, filters, nil
         
     | 
| 
       130 
130 
     | 
    
         
             
                    batch_status.to_h.tap { FFI.pbs_statfree batch_status }
         
     | 
| 
       131 
131 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -168,7 +168,7 @@ class OodCore::Job::Adapters::Torque 
     | 
|
| 
       168 
168 
     | 
    
         
             
                # @return [Hash] hash of details for nodes
         
     | 
| 
       169 
169 
     | 
    
         
             
                def get_nodes(id: '', filters: [])
         
     | 
| 
       170 
170 
     | 
    
         
             
                  connect do |cid|
         
     | 
| 
       171 
     | 
    
         
            -
                    filters = Attrl.from_list(filters)
         
     | 
| 
      
 171 
     | 
    
         
            +
                    filters = FFI::Attrl.from_list(filters)
         
     | 
| 
       172 
172 
     | 
    
         
             
                    batch_status = FFI.pbs_statnode cid, id.to_s, filters, nil
         
     | 
| 
       173 
173 
     | 
    
         
             
                    batch_status.to_h.tap { FFI.pbs_statfree batch_status }
         
     | 
| 
       174 
174 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -213,7 +213,7 @@ class OodCore::Job::Adapters::Torque 
     | 
|
| 
       213 
213 
     | 
    
         
             
                #
         
     | 
| 
       214 
214 
     | 
    
         
             
                def select_jobs(attribs: [])
         
     | 
| 
       215 
215 
     | 
    
         
             
                  connect do |cid|
         
     | 
| 
       216 
     | 
    
         
            -
                    attribs = Attropl.from_list(attribs.map(&:to_h))
         
     | 
| 
      
 216 
     | 
    
         
            +
                    attribs = FFI::Attropl.from_list(attribs.map(&:to_h))
         
     | 
| 
       217 
217 
     | 
    
         
             
                    batch_status = FFI.pbs_selstat cid, attribs, nil
         
     | 
| 
       218 
218 
     | 
    
         
             
                    batch_status.to_h.tap { FFI.pbs_statfree batch_status }
         
     | 
| 
       219 
219 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -377,7 +377,7 @@ class OodCore::Job::Adapters::Torque 
     | 
|
| 
       377 
377 
     | 
    
         
             
                    end
         
     | 
| 
       378 
378 
     | 
    
         | 
| 
       379 
379 
     | 
    
         
             
                    connect do |cid|
         
     | 
| 
       380 
     | 
    
         
            -
                      attropl = Attropl.from_list attribs
         
     | 
| 
      
 380 
     | 
    
         
            +
                      attropl = FFI::Attropl.from_list attribs
         
     | 
| 
       381 
381 
     | 
    
         
             
                      FFI.pbs_submit cid, attropl, script, queue, nil
         
     | 
| 
       382 
382 
     | 
    
         
             
                    end
         
     | 
| 
       383 
383 
     | 
    
         
             
                  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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jeremy Nicklas
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2018-12- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2018-12-27 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: ood_support
         
     | 
| 
         @@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       193 
193 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       194 
194 
     | 
    
         
             
            requirements: []
         
     | 
| 
       195 
195 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       196 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 196 
     | 
    
         
            +
            rubygems_version: 2.7.3
         
     | 
| 
       197 
197 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       198 
198 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       199 
199 
     | 
    
         
             
            summary: Open OnDemand core library
         
     |