From d8768d224e533901f1d27d674625a482cae6ae4a Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Thu, 15 Jun 2023 10:44:10 -0400 Subject: [PATCH] Adjust Slurm monkey-patches to accept new command caller API --- src/toil/lib/misc.py | 3 +++ src/toil/test/batchSystems/test_slurm.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/toil/lib/misc.py b/src/toil/lib/misc.py index 66144d3a45..fb24850d21 100644 --- a/src/toil/lib/misc.py +++ b/src/toil/lib/misc.py @@ -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: diff --git a/src/toil/test/batchSystems/test_slurm.py b/src/toil/test/batchSystems/test_slurm.py index a5c9b75fb0..3dbc5c8a4d 100644 --- a/src/toil/test/batchSystems/test_slurm.py +++ b/src/toil/test/batchSystems/test_slurm.py @@ -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', '', '--format', @@ -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', '']