diff --git a/tests/test_lsf_cancel.py b/tests/test_lsf_cancel.py index 9972a8e..71919d2 100644 --- a/tests/test_lsf_cancel.py +++ b/tests/test_lsf_cancel.py @@ -73,7 +73,7 @@ def test_kill_jobs_one_job( kill_jobs(jobids) - run_process_mock.assert_called_once_with(expected_kill_cmd) + run_process_mock.assert_called_once_with(expected_kill_cmd, check=False) @patch.object( OSLayer, @@ -92,7 +92,7 @@ def test_kill_jobs_two_jobs( kill_jobs(jobids) - run_process_mock.assert_called_once_with(expected_kill_cmd) + run_process_mock.assert_called_once_with(expected_kill_cmd, check=False) @patch.object( OSLayer, @@ -133,4 +133,4 @@ def test_kill_jobs_empty_job_and_non_empty_job(self, run_process_mock): kill_jobs(jobids) - run_process_mock.assert_called_once_with(expected_kill_cmd) + run_process_mock.assert_called_once_with(expected_kill_cmd, check=False) diff --git a/{{cookiecutter.profile_name}}/OSLayer.py b/{{cookiecutter.profile_name}}/OSLayer.py index 349b081..9e5b8c5 100644 --- a/{{cookiecutter.profile_name}}/OSLayer.py +++ b/{{cookiecutter.profile_name}}/OSLayer.py @@ -36,9 +36,9 @@ def remove_file(file: Path): file.unlink() @staticmethod - def run_process(cmd: str) -> Tuple[stdout, stderr]: + def run_process(cmd: str, check: bool = True) -> Tuple[stdout, stderr]: completed_process = subprocess.run( - cmd, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE + cmd, check=check, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) return ( completed_process.stdout.decode().strip(), diff --git a/{{cookiecutter.profile_name}}/lsf_cancel.py b/{{cookiecutter.profile_name}}/lsf_cancel.py index 409deec..48399fa 100755 --- a/{{cookiecutter.profile_name}}/lsf_cancel.py +++ b/{{cookiecutter.profile_name}}/lsf_cancel.py @@ -18,7 +18,7 @@ def kill_jobs(ids_to_kill: List[str]): # we don't want to run bkill with no argument as this will kill the last job if any(ids_to_kill): cmd = "{} {}".format(KILL, " ".join(ids_to_kill)) - _ = OSLayer.run_process(cmd) + _ = OSLayer.run_process(cmd, check=False) def parse_input() -> List[str]: