ood_core 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cf4709dc9c8753f8229ae67403a0498e9cb8602
4
- data.tar.gz: 2f555177a357923753dc246aa4c56811349d4b74
3
+ metadata.gz: 13f67ce37546552c1f3b8849dca41458b066cb36
4
+ data.tar.gz: 56142c67e2210211d4525982abb5254999306b6a
5
5
  SHA512:
6
- metadata.gz: 702a25970cf24f9cda29e2adbd57c64003fc3cc60cc07b1da89f2d1c4bb5fb3153e688081c58139fd8ba7cb5623f6a08e16cbbf13737ee61194d1aafcb3d5a8a
7
- data.tar.gz: ff5b02ee6b00d43b14568ad91768fcd8b1c8bde7166c112b2df215702bb1f7632e0e154e1954bb974ed1a3e1c71736e3f2aa88385d1d8563e20ab2759ea45ab7
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:
@@ -64,7 +64,7 @@ module OodCore
64
64
  # Whether the login feature is allowed
65
65
  # @return [Boolean] is login allowed
66
66
  def login_allow?
67
- allow? && !login.empty?
67
+ allow? && !login_config.empty?
68
68
  end
69
69
 
70
70
  # Build a job adapter from the job configuration
@@ -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 [#to_s] :cluster ('') The cluster to communicate with
12
- # @option config [#to_s] :bin ('') Path to slurm client binaries
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, "").to_s
16
- bin = c.fetch(:bin, "").to_s
17
- slurm = Adapters::Slurm::Batch.new(cluster: cluster, bin: bin)
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: "", bin: "")
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.empty? ? 1 : 2).map do |line|
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] unless cluster.empty?
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
@@ -82,8 +82,9 @@ module OodCore
82
82
  # @return [Fixnum, nil] scheduling priority
83
83
  attr_reader :priority
84
84
 
85
- # The minmimum amount of physical memory in kilobyte that should be available
86
- # for the job
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
 
@@ -1,4 +1,4 @@
1
1
  module OodCore
2
2
  # The current version of {OodCore}
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
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.2
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-27 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ood_support