Skip to content

Commit

Permalink
Add actions to set weight and gres (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimesouza committed Jun 26, 2024
1 parent 399a263 commit c0c3ab5
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ This file keeps track of all notable changes to the Slurm Charms.

Unreleased
----------
- updated slurm-ops-manager to version 0.8.17
- added actions to set node weight and gres
- updated slurm-ops-manager to version 0.8.18


1.1.3 - 2023-12-11
Expand Down
2 changes: 1 addition & 1 deletion charm-slurmctld/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ influxdb==5.3.1
urllib3==1.26.9
etcd3gw==1.0.2
jinja2==3.1.2
git+https://github.com/omnivector-solutions/[email protected].17
git+https://github.com/omnivector-solutions/[email protected].18
13 changes: 12 additions & 1 deletion charm-slurmd/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ set-node-inventory:
real-memory:
type: integer
description: Total amount of memory of the node, in MB.

set-node-weight:
description: Modify node weight.
params:
value:
type: integer
description: Node weight.
set-node-gres:
description: Modify node GRES.
params:
value:
type: string
description: GRES setup.
show-nhc-config:
description: Display the currently used `nhc.conf`.
2 changes: 1 addition & 1 deletion charm-slurmd/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ops==1.3.0
urllib3==1.26.9
etcd3gw==1.0.2
git+https://github.com/omnivector-solutions/[email protected].17
git+https://github.com/omnivector-solutions/[email protected].18
28 changes: 28 additions & 0 deletions charm-slurmd/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def __init__(self, *args):
self.on.node_configured_action: self._on_node_configured_action,
self.on.get_node_inventory_action: self._on_get_node_inventory_action,
self.on.set_node_inventory_action: self._on_set_node_inventory_action,
self.on.set_node_weight_action: self._on_set_node_weight_action,
self.on.set_node_gres_action: self._on_set_node_gres_action,
self.on.show_nhc_config_action: self._on_show_nhc_config,
}
for event, handler in event_handler_bindings.items():
Expand Down Expand Up @@ -422,6 +424,32 @@ def _on_set_node_inventory_action(self, event):

event.set_results({"real-memory": memory})

def _on_set_node_weight_action(self, event):
"""Overwrite the node inventory."""
inventory = self._slurmd.node_inventory

# update local copy of inventory
weight = event.params.get("value")
inventory["weight"] = weight

# send it to slurmctld
self._slurmd.node_inventory = inventory

event.set_results({"weight": weight})

def _on_set_node_gres_action(self, event):
"""Overwrite the node inventory."""
inventory = self._slurmd.node_inventory

# update local copy of inventory
gres = event.params.get("value")
inventory["gres"] = gres

# send it to slurmctld
self._slurmd.node_inventory = inventory

event.set_results({"gres": gres})

def _on_show_nhc_config(self, event):
"""Show current nhc.conf."""
nhc_conf = self._slurm_manager.get_nhc_config()
Expand Down
2 changes: 1 addition & 1 deletion charm-slurmdbd/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ops==1.3.0
git+https://github.com/omnivector-solutions/[email protected].17
git+https://github.com/omnivector-solutions/[email protected].18
2 changes: 1 addition & 1 deletion charm-slurmrestd/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ops==1.3.0
git+https://github.com/omnivector-solutions/[email protected].17
git+https://github.com/omnivector-solutions/[email protected].18

0 comments on commit c0c3ab5

Please sign in to comment.