ood_core 0.31.1 → 0.31.2

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: a2dab30b28f29c33b19e8cce3b5464805c09ba374336ac68fa27da684826fca6
4
- data.tar.gz: f94e04cb03fa816f4fa54f72e43acdfac2e5a3ee301bd0de59624ed4367669f7
3
+ metadata.gz: 22a88595820178ebd312d5c90bf151737c34d3ce3aff58d8e1d0b617340f4800
4
+ data.tar.gz: 73edf9d90d8dcb97e39b698dca68065f8ff7844dc823ed77a3fd24a54ea83b3a
5
5
  SHA512:
6
- metadata.gz: 627ea1414e51fe18601977b50ad1b6472e58904a4ec6571620bc4a7dfa382c952e6aee65e04243352e4ed7ef842365a559134c2155d27c47a77fda819385afe0
7
- data.tar.gz: 535c8466bf1e18192b850ab6c0c116c7b36173923c918c9bccc23d4e751acc9178c7f16a189efa518e103ec57be2b72e6d68d8ab2d11ec55a5874a525fac0ac5
6
+ metadata.gz: 006ec6f820b5541f99f44b26cdbe310edeae8841751da62ee8f47aa9dc43162b6630d4286060fd43ac61baf6f5a115f803ca0f2f1ff4013bf3055a31d2507489
7
+ data.tar.gz: 5d0cab41a9d413c53ed5a5184e985c07ec263dff69372c2031d8aa77ae375f7809618a9d29e363380bbe8f633010997cb86f1c3b2de509411ee1c4280441410d
@@ -103,24 +103,6 @@ module OodCore
103
103
  info(id).status
104
104
  end
105
105
 
106
- # This adapter does not implement hold and will always raise
107
- # an exception.
108
- # @param id [#to_s] the id of the job
109
- # @raise [JobAdapterError] always
110
- # @return [void]
111
- def hold(_)
112
- raise NotImplementedError, "subclass did not define #hold"
113
- end
114
-
115
- # This adapter does not implement release and will always raise
116
- # an exception.
117
- # @param id [#to_s] the id of the job
118
- # @raise [JobAdapterError] always
119
- # @return [void]
120
- def release(_)
121
- raise NotImplementedError, "subclass did not define #release"
122
- end
123
-
124
106
  # Delete the submitted job
125
107
  # @param id [#to_s] the id of the job
126
108
  # @return [void]
@@ -175,7 +175,9 @@ module OodCore
175
175
  dispatch_time: "JobCurrentStartDate",
176
176
  sys_cpu_time: "RemoteSysCpu",
177
177
  user_cpu_time: "RemoteUserCpu",
178
- wallclock_time: "RemoteWallClockTime"
178
+ wallclock_time: "RemoteWallClockTime",
179
+ wallclock_limit: "AllowedExecuteDuration",
180
+ server_time: "ServerTime"
179
181
  }
180
182
  end
181
183
 
@@ -312,7 +314,7 @@ module OodCore
312
314
  # @raise [JobAdapterError] if something goes wrong submitting a job
313
315
  # @return [String] the job id returned after successfully submitting a
314
316
  # job
315
- def submit(script)
317
+ def submit(script, after: [], afterok: [], afternotok: [], afterany: [])
316
318
  args = []
317
319
  args.concat ["-batch-name", "#{script.job_name}"] unless script.job_name.nil?
318
320
  args.concat ["-name", "#{script.queue_name}"] unless script.queue_name.nil?
@@ -530,12 +532,44 @@ module OodCore
530
532
  submission_time: Time.at(job[:submission_time].to_i),
531
533
  dispatch_time: Time.at(job[:dispatch_time].to_i),
532
534
  cpu_time: job[:sys_cpu_time].to_i + job[:user_cpu_time].to_i,
533
- wallclock_time: job[:wallclock_time].to_i,
535
+ wallclock_time: wallclock_time(job),
536
+ wallclock_limit: wallclock_limit(job),
534
537
  native: job[:native],
535
538
 
536
539
  )
537
540
  end
538
541
 
542
+ # Compute the elapsed wall clock time for a job in seconds.
543
+ #
544
+ # RemoteWallClockTime only accumulates time from *completed* runs; it is
545
+ # not updated while a job is currently executing. So for a running job we
546
+ # add the time elapsed since it started running, otherwise the remaining
547
+ # time (wallclock_limit - wallclock_time) never counts down.
548
+ def wallclock_time(job)
549
+ wallclock = job[:wallclock_time].to_i
550
+ if get_state(job[:status]) == :running
551
+ start = job[:dispatch_time].to_i
552
+ if start > 0
553
+ # Prefer the schedd's clock (ServerTime) to avoid skew between hosts
554
+ now = job[:server_time].to_i
555
+ now = Time.now.to_i if now <= 0
556
+ current_run = now - start
557
+ wallclock += current_run if current_run > 0
558
+ end
559
+ end
560
+ wallclock
561
+ end
562
+
563
+ # Parse the wall clock time limit (AllowedExecuteDuration) in seconds.
564
+ #
565
+ # Returns nil when the attribute is undefined (job submitted without a
566
+ # wall time) so the remaining time is treated as unlimited rather than
567
+ # incorrectly computed against a zero limit.
568
+ def wallclock_limit(job)
569
+ limit = job[:wallclock_limit].to_s
570
+ limit.match?(/\A\d+\z/) ? limit.to_i : nil
571
+ end
572
+
539
573
  # Parse group information into AccountInfo objects
540
574
  # @param groups [Array<String>] list of group names
541
575
  # @return [Array<AccountInfo>] list of AccountInfo objects
@@ -51,7 +51,7 @@ class OodCore::Job::Adapters::LinuxHost::Launcher
51
51
  @strict_host_checking = strict_host_checking
52
52
  @submit_host = submit_host
53
53
  @tmux_bin = tmux_bin
54
- @username = Etc.getlogin
54
+ @username = Etc.getpwuid.name
55
55
  end
56
56
 
57
57
  # @param hostname [#to_s] The hostname to submit the work to
@@ -122,8 +122,7 @@ module OodCore
122
122
  # @return [ClusterInfo] object containing cluster details
123
123
  def get_cluster_info
124
124
  node_cpu_info = call("sinfo", "-aho %F/%C").strip.split('/').map(&:to_i)
125
- gres_length = call("sinfo", "-o %G").lines.map(&:strip).map(&:length).max + 2
126
- gres_lines = call("sinfo", "-ahNO", "nodehost,gres:#{gres_length},gresused:#{gres_length},statelong")
125
+ gres_lines = call("sinfo", "-ahNO", "nodehost:100,gres:512,gresused:512,statelong")
127
126
  .lines.uniq.reject { |line| line.match?(/maint|drain|down/i) }.map(&:split)
128
127
 
129
128
  node_info = sinfo_headers.zip(node_cpu_info).to_h
@@ -1,4 +1,4 @@
1
1
  module OodCore
2
2
  # The current version of {OodCore}
3
- VERSION = "0.31.1"
3
+ VERSION = "0.31.2"
4
4
  end
data/ood_core.gemspec CHANGED
@@ -26,7 +26,9 @@ Gem::Specification.new do |spec|
26
26
  spec.add_runtime_dependency "ffi", "~> 1.16.3"
27
27
  spec.add_runtime_dependency "fog-openstack", "~> 1.1.5"
28
28
  spec.add_runtime_dependency "rexml", "~> 3.2"
29
- spec.add_development_dependency "bundler", "~> 2.1"
29
+ spec.add_runtime_dependency "ostruct"
30
+ spec.add_runtime_dependency "base64"
31
+
30
32
  spec.add_development_dependency "rake", "~> 13.4.1"
31
33
  spec.add_development_dependency "rspec", "~> 3.0"
32
34
  spec.add_development_dependency "pry", "~> 0.10"
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.31.1
4
+ version: 0.31.2
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: 2026-04-20 00:00:00.000000000 Z
13
+ date: 2026-11-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ood_support
@@ -69,19 +69,33 @@ dependencies:
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.2'
71
71
  - !ruby/object:Gem::Dependency
72
- name: bundler
72
+ name: ostruct
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - "~>"
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: '2.1'
78
- type: :development
77
+ version: '0'
78
+ type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - "~>"
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: base64
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
83
97
  - !ruby/object:Gem::Version
84
- version: '2.1'
98
+ version: '0'
85
99
  - !ruby/object:Gem::Dependency
86
100
  name: rake
87
101
  requirement: !ruby/object:Gem::Requirement