-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a `cluster_info` API to adapters to report the current cluster status like how many nodes, cpus and GPUs are active among other stuff.
- Loading branch information
Showing
5 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module OodCore | ||
module Job | ||
# An object that contains details about the cluster's active and total nodes, processors, and gpus | ||
class ClusterInfo | ||
using Refinements::HashExtensions | ||
|
||
attr_reader :active_nodes, :total_nodes, :active_processors, :total_processors, :active_gpu_nodes, | ||
:total_gpu_nodes, :active_gpus, :total_gpus | ||
|
||
def initialize(opts = {}) | ||
opts = opts.transform_keys(&:to_sym) | ||
@active_nodes = opts.fetch(:active_nodes, nil).to_i | ||
@total_nodes = opts.fetch(:total_nodes, nil).to_i | ||
@active_processors = opts.fetch(:active_processors, nil).to_i | ||
@total_processors = opts.fetch(:total_processors, nil).to_i | ||
@active_gpus = opts.fetch(:active_gpus, nil).to_i | ||
@total_gpus = opts.fetch(:total_gpus, nil).to_i | ||
end | ||
|
||
def to_h | ||
{ | ||
active_nodes: active_nodes, | ||
total_nodes: total_nodes, | ||
active_processors: active_processors, | ||
total_processors: total_processors, | ||
active_gpus: active_gpus, | ||
total_gpus: total_gpus | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters