Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stop/start systemd calls #57

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions lib/charms/hpc_libs/v0/slurm_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,37 @@ def type(self) -> _ServiceType:
class _SystemctlServiceManager(_ServiceManager):
"""Control a Slurm service using systemctl services."""

def start(self) -> None:
"""Start service.

Raises:
SlurmOpsError: Raised if `systemctl start ...` returns a non-zero returncode.
"""
_systemctl("start", self._service.value)

def stop(self) -> None:
"""Stop service.

Raises:
SlurmOpsError: Raised if `systemctl stop ...` returns a non-zero returncode.
"""
_systemctl("stop", self._service.value)

def enable(self) -> None:
"""Enable service.

Raises:
SlurmOpsError: Raised if `systemctl enable ...` returns a non-zero returncode.
"""
_systemctl("enable", "--now", self._service.value)
_systemctl("enable", self._service.value)

def disable(self) -> None:
"""Disable service."""
_systemctl("disable", "--now", self._service.value)
"""Disable service.

Raises:
SlurmOpsError: Raised if `systemctl disable ...` returns a non-zero returncode.
"""
_systemctl("disable", self._service.value)

def restart(self) -> None:
"""Restart service."""
Expand Down
Loading