Skip to content

Commit

Permalink
Adjust Slurm monkey-patches to accept new command caller API
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnovak committed Jun 15, 2023
1 parent fdec2a2 commit d8768d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/toil/lib/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def call_command(cmd: List[str], *args: str, input: Optional[str] = None, timeou
:returns: Command standard output, decoded as utf-8.
"""

# NOTE: Interface MUST be kept in sync with call_sacct and call_scontrol in
# test_slurm.py, which monkey-patch this!

# using non-C locales can cause GridEngine commands, maybe other to
# generate errors
if useCLocale:
Expand Down
6 changes: 4 additions & 2 deletions src/toil/test/batchSystems/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from toil.lib.misc import CalledProcessErrorStderr
from toil.test import ToilTest

# TODO: Come up with a better way to mock the commands then monkey-patching the
# command-calling functions.

def call_sacct(args) -> str:
def call_sacct(args, **_) -> str:
"""
The arguments passed to `call_command` when executing `sacct` are:
['sacct', '-n', '-j', '<comma-separated list of job-ids>', '--format',
Expand Down Expand Up @@ -41,7 +43,7 @@ def call_sacct(args) -> str:
return stdout


def call_scontrol(args) -> str:
def call_scontrol(args, **_) -> str:
"""
The arguments passed to `call_command` when executing `scontrol` are:
['scontrol', 'show', 'job'] or ['scontrol', 'show', 'job', '<job-id>']
Expand Down

0 comments on commit d8768d2

Please sign in to comment.