ood_core 0.0.2 → 0.0.3
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 +11 -0
 - data/lib/ood_core/cluster.rb +1 -1
 - data/lib/ood_core/job/adapters/slurm.rb +22 -11
 - data/lib/ood_core/job/script.rb +3 -2
 - 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: 13f67ce37546552c1f3b8849dca41458b066cb36
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 56142c67e2210211d4525982abb5254999306b6a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 56cfa06bd1d20bb00bc1362a1dbc484c03c600c7f30525fe51b483bfe6fe950b81c33fcd6ec214815cf538670525a46c423aea5a4e3a23aa44d2cc11ff31b115
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 03d29f9582ae5609c159fad74825f16f96de0ff091aa150ad6f9cdf8a4b8899148ab8f0220fb8f6bbe18d438ec15784a9f95d6432883d658d13ee21781cd8cf7
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ## Unreleased
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 0.0.3 (2017-04-28)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Features:
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              - provide support for slurm conf file
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Bugfixes:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              - correct code documentation for `Script#min_phys_memory`
         
     | 
| 
      
 12 
     | 
    
         
            +
              - fix for login feature being allowed on all clusters even if not defined
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       3 
14 
     | 
    
         
             
            ## 0.0.2 (2017-04-27)
         
     | 
| 
       4 
15 
     | 
    
         | 
| 
       5 
16 
     | 
    
         
             
            Features:
         
     | 
    
        data/lib/ood_core/cluster.rb
    CHANGED
    
    
| 
         @@ -8,13 +8,15 @@ module OodCore 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                  # Build the Slurm adapter from a configuration
         
     | 
| 
       10 
10 
     | 
    
         
             
                  # @param config [#to_h] the configuration for job adapter
         
     | 
| 
       11 
     | 
    
         
            -
                  # @option config [ 
     | 
| 
       12 
     | 
    
         
            -
                  # @option config [ 
     | 
| 
      
 11 
     | 
    
         
            +
                  # @option config [Object] :cluster (nil) The cluster to communicate with
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # @option config [Object] :conf (nil) Path to the slurm conf
         
     | 
| 
      
 13 
     | 
    
         
            +
                  # @option config [Object] :bin (nil) Path to slurm client binaries
         
     | 
| 
       13 
14 
     | 
    
         
             
                  def self.build_slurm(config)
         
     | 
| 
       14 
15 
     | 
    
         
             
                    c = config.to_h.symbolize_keys
         
     | 
| 
       15 
     | 
    
         
            -
                    cluster = c.fetch(:cluster,  
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
      
 16 
     | 
    
         
            +
                    cluster = c.fetch(:cluster, nil)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    conf    = c.fetch(:conf, nil)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    bin     = c.fetch(:bin, nil)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    slurm = Adapters::Slurm::Batch.new(cluster: cluster, conf: conf, bin: bin)
         
     | 
| 
       18 
20 
     | 
    
         
             
                    Adapters::Slurm.new(slurm: slurm)
         
     | 
| 
       19 
21 
     | 
    
         
             
                  end
         
     | 
| 
       20 
22 
     | 
    
         
             
                end
         
     | 
| 
         @@ -31,9 +33,15 @@ module OodCore 
     | 
|
| 
       31 
33 
     | 
    
         
             
                      # The cluster of the Slurm batch server
         
     | 
| 
       32 
34 
     | 
    
         
             
                      # @example CHPC's kingspeak cluster
         
     | 
| 
       33 
35 
     | 
    
         
             
                      #   my_batch.cluster #=> "kingspeak"
         
     | 
| 
       34 
     | 
    
         
            -
                      # @return [String] the cluster name
         
     | 
| 
      
 36 
     | 
    
         
            +
                      # @return [String, nil] the cluster name
         
     | 
| 
       35 
37 
     | 
    
         
             
                      attr_reader :cluster
         
     | 
| 
       36 
38 
     | 
    
         | 
| 
      
 39 
     | 
    
         
            +
                      # The path to the Slurm configuration file
         
     | 
| 
      
 40 
     | 
    
         
            +
                      # @example For Slurm 10.0.0
         
     | 
| 
      
 41 
     | 
    
         
            +
                      #   my_batch.conf.to_s #=> "/usr/local/slurm/10.0.0/etc/slurm.conf
         
     | 
| 
      
 42 
     | 
    
         
            +
                      # @return [Pathname, nil] path to slurm conf
         
     | 
| 
      
 43 
     | 
    
         
            +
                      attr_reader :conf
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
       37 
45 
     | 
    
         
             
                      # The path to the Slurm client installation binaries
         
     | 
| 
       38 
46 
     | 
    
         
             
                      # @example For Slurm 10.0.0
         
     | 
| 
       39 
47 
     | 
    
         
             
                      #   my_batch.bin.to_s #=> "/usr/local/slurm/10.0.0/bin
         
     | 
| 
         @@ -44,10 +52,12 @@ module OodCore 
     | 
|
| 
       44 
52 
     | 
    
         
             
                      # from
         
     | 
| 
       45 
53 
     | 
    
         
             
                      class Error < StandardError; end
         
     | 
| 
       46 
54 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                      # @param cluster [#to_s] the cluster name
         
     | 
| 
      
 55 
     | 
    
         
            +
                      # @param cluster [#to_s, nil] the cluster name
         
     | 
| 
      
 56 
     | 
    
         
            +
                      # @param conf [#to_s, nil] path to the slurm conf
         
     | 
| 
       48 
57 
     | 
    
         
             
                      # @param bin [#to_s] path to slurm installation binaries
         
     | 
| 
       49 
     | 
    
         
            -
                      def initialize(cluster:  
     | 
| 
       50 
     | 
    
         
            -
                        @cluster = cluster.to_s
         
     | 
| 
      
 58 
     | 
    
         
            +
                      def initialize(cluster: nil, bin: nil, conf: nil)
         
     | 
| 
      
 59 
     | 
    
         
            +
                        @cluster = cluster && cluster.to_s
         
     | 
| 
      
 60 
     | 
    
         
            +
                        @conf    = conf    && Pathname.new(conf.to_s)
         
     | 
| 
       51 
61 
     | 
    
         
             
                        @bin     = Pathname.new(bin.to_s)
         
     | 
| 
       52 
62 
     | 
    
         
             
                      end
         
     | 
| 
       53 
63 
     | 
    
         | 
| 
         @@ -80,7 +90,7 @@ module OodCore 
     | 
|
| 
       80 
90 
     | 
    
         
             
                        args += ["-j", id.to_s] unless id.to_s.empty?
         
     | 
| 
       81 
91 
     | 
    
         
             
                        lines = call("squeue", *args).split("\n").map(&:strip)
         
     | 
| 
       82 
92 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                        lines.drop(cluster 
     | 
| 
      
 93 
     | 
    
         
            +
                        lines.drop(cluster ? 2 : 1).map do |line|
         
     | 
| 
       84 
94 
     | 
    
         
             
                          Hash[options.keys.zip(line.split(delim))]
         
     | 
| 
       85 
95 
     | 
    
         
             
                        end
         
     | 
| 
       86 
96 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -132,8 +142,9 @@ module OodCore 
     | 
|
| 
       132 
142 
     | 
    
         
             
                        def call(cmd, *args, env: {}, stdin: "")
         
     | 
| 
       133 
143 
     | 
    
         
             
                          cmd = bin.join(cmd.to_s).to_s
         
     | 
| 
       134 
144 
     | 
    
         
             
                          args  = args.map(&:to_s)
         
     | 
| 
       135 
     | 
    
         
            -
                          args += ["-M", cluster]  
     | 
| 
      
 145 
     | 
    
         
            +
                          args += ["-M", cluster] if cluster
         
     | 
| 
       136 
146 
     | 
    
         
             
                          env = env.to_h
         
     | 
| 
      
 147 
     | 
    
         
            +
                          env["SLURM_CONF"] = conf.to_s if conf
         
     | 
| 
       137 
148 
     | 
    
         
             
                          o, e, s = Open3.capture3(env, cmd, *args, stdin_data: stdin.to_s)
         
     | 
| 
       138 
149 
     | 
    
         
             
                          s.success? ? o : raise(Error, e)
         
     | 
| 
       139 
150 
     | 
    
         
             
                        end
         
     | 
    
        data/lib/ood_core/job/script.rb
    CHANGED
    
    | 
         @@ -82,8 +82,9 @@ module OodCore 
     | 
|
| 
       82 
82 
     | 
    
         
             
                  # @return [Fixnum, nil] scheduling priority
         
     | 
| 
       83 
83 
     | 
    
         
             
                  attr_reader :priority
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
                  # The  
     | 
| 
       86 
     | 
    
         
            -
                  #  
     | 
| 
      
 85 
     | 
    
         
            +
                  # The minimum amount of physical memory in kilobyte for all nodes or per
         
     | 
| 
      
 86 
     | 
    
         
            +
                  # node (dependent upon the resource manager) that should be available for
         
     | 
| 
      
 87 
     | 
    
         
            +
                  # the job
         
     | 
| 
       87 
88 
     | 
    
         
             
                  # @return [Fixnum, nil] minimum physical memory
         
     | 
| 
       88 
89 
     | 
    
         
             
                  attr_reader :min_phys_memory
         
     | 
| 
       89 
90 
     | 
    
         | 
    
        data/lib/ood_core/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-04-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: ood_support
         
     |