Class: ResourceManagerAdapter::Linux
- Inherits:
-
Object
- Object
- ResourceManagerAdapter::Linux
- Defined in:
- lib/wf_node_api/resource_manager_adapter/linux.rb
Overview
ResourceManager adapter for Linux
Instance Method Summary collapse
-
#initialize ⇒ Linux
constructor
Initializes the adapter.
-
#total_cpu_cores ⇒ Integer
Finds the total amount of cpu cores.
Constructor Details
#initialize ⇒ Linux
Initializes the adapter
37 38 39 40 41 |
# File 'lib/wf_node_api/resource_manager_adapter/linux.rb', line 37 def initialize if $container_type == 'LXC' && File.exists?($lxc_cgroup_mount_path) == false raise RuntimeError, 'no cgroup node found' end end |
Instance Method Details
#total_cpu_cores ⇒ Integer
Finds the total amount of cpu cores
46 47 48 49 50 51 52 53 54 |
# File 'lib/wf_node_api/resource_manager_adapter/linux.rb', line 46 def total_cpu_cores cpu_cores = `nproc`.strip.to_i if $?.exitstatus != 0 raise RuntimeError, 'could not run nproc' end return cpu_cores end |