Skip to content

Commit

Permalink
fix(slurmctld,slurmdbd): correct type hints for pyright
Browse files Browse the repository at this point in the history
`pyright` doesn't like the dynamic attributes provided by the `slurmutils`
config models in the `slurmdbd` charm, so we'll need to enable type checking
over on that project.

For the `slurmctld` charm, we just needed to correct the hint for
`assemble_slurmctld_parameters` to be `dict[str, Any]` rather than
string which is returned for the slurm.conf editor.

Signed-off-by: Jason C. Nucciarone <[email protected]>
  • Loading branch information
NucciTheBoss committed Nov 15, 2024
1 parent 9e3bbb1 commit 14b32f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charms/slurmctld/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _assemble_slurm_conf(self) -> SlurmConfig:

slurmd_parameters = self._slurmd.get_new_nodes_and_nodes_and_partitions()

def _assemble_slurmctld_parameters() -> str:
def _assemble_slurmctld_parameters() -> dict[str, Any]:
# Preprocess merging slurmctld_parameters if they exist in the context
slurmctld_parameters = {"enable_configless": True}

Expand All @@ -279,7 +279,7 @@ def _assemble_slurmctld_parameters() -> str:
):
for opt in user_supplied_slurmctld_parameters.split(","):
k, v = opt.split("=", maxsplit=1)
slurmctld_parameters.update(k, v)
slurmctld_parameters.update({k: v})

return slurmctld_parameters

Expand Down
2 changes: 2 additions & 0 deletions charms/slurmdbd/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

"""Slurmdbd Operator Charm."""

# pyright: reportAttributeAccessIssue=false

import logging
from time import sleep
from typing import Any, Dict, Union
Expand Down

0 comments on commit 14b32f0

Please sign in to comment.