Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Update help message (#357)
Browse files Browse the repository at this point in the history
* Update help message

Update help text for add_sus and subtract_sus to be more specific

* Update parsers.py

* Update account_logic.py

Added error message if unlock run without sudo privilege

---------

Co-authored-by: Nickolas Comeau <[email protected]>
  • Loading branch information
chnixi and Comeani authored Mar 5, 2024
1 parent 9f6e333 commit c9bc8ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion bank/account_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .exceptions import *
from .orm import Account, Allocation, DBConnection, Investment, Proposal
from .system import EmailTemplate, Slurm, SlurmAccount
from os import geteuid

Numeric = Union[int, float]
LOG = getLogger('bank.account_services')
Expand Down Expand Up @@ -1095,10 +1096,13 @@ def unlock(self, clusters: Optional[Collection[str]] = None, all_clusters=False)
"""Unlock the account on the given clusters
Args:
clusters: Name of the clusters to unlock the account on. Defaults to all clusters.
clusters: Name of the clusters to unlock the account on. Defaults to all clusters. Must have sudo privileges to execute.
all_clusters: Lock the user on all clusters
"""

if geteuid() != 0:
exit("ERROR: `unlock` must be run with sudo privileges!")

self._set_account_lock(False, clusters, all_clusters)


Expand Down
4 changes: 2 additions & 2 deletions bank/cli/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ def _add_cluster_args(parser: ArgumentParser) -> None:
"""

su_argument = dict(metavar='su', type=NonNegativeInt, default=0)
parser.add_argument('--all-clusters', **su_argument, help='service units awarded across all clusters')
parser.add_argument('--all-clusters', **su_argument, help='service units awarded/added/subtracted from all-clusters allocation, depending on invoked proposal operation')

# Add per-cluster arguments for setting service units
for cluster in settings.clusters:
parser.add_argument(f'--{cluster}', **su_argument, help=f'service units awarded on the {cluster} cluster')
parser.add_argument(f'--{cluster}', **su_argument, help=f'service units awarded/added/subtracted on the {cluster} cluster, depending on invoked proposal operation')


class InvestmentParser(BaseParser):
Expand Down

0 comments on commit c9bc8ea

Please sign in to comment.