diff --git a/src/ert/scheduler/lsf_driver.py b/src/ert/scheduler/lsf_driver.py index 469ec46c81c..53155e25b27 100644 --- a/src/ert/scheduler/lsf_driver.py +++ b/src/ert/scheduler/lsf_driver.py @@ -435,6 +435,7 @@ async def poll(self) -> None: current_jobids = list(self._jobs.keys()) try: + print("POLLLING BJOBS") process = await asyncio.create_subprocess_exec( str(self._bjobs_cmd), "-noheader", @@ -583,12 +584,17 @@ async def _poll_once_by_bhist( if time.time() - self._bhist_cache_timestamp < self._bhist_required_cache_age: return {} - process = await asyncio.create_subprocess_exec( - self._bhist_cmd, - *[str(job_id) for job_id in missing_job_ids], - stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE, - ) + try: + process = await asyncio.create_subprocess_exec( + self._bhist_cmd, + *[str(job_id) for job_id in missing_job_ids], + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + ) + except FileNotFoundError as e: + logger.error(str(e)) + return {} + stdout, stderr = await process.communicate() if process.returncode: logger.error( diff --git a/tests/ert/unit_tests/scheduler/test_lsf_driver.py b/tests/ert/unit_tests/scheduler/test_lsf_driver.py index 7064748a99b..2941d4a6581 100644 --- a/tests/ert/unit_tests/scheduler/test_lsf_driver.py +++ b/tests/ert/unit_tests/scheduler/test_lsf_driver.py @@ -1269,6 +1269,20 @@ def mock_poll_once_by_bhist(*args, **kwargs): assert job_id in driver._bhist_cache +@pytest.mark.integration_test +async def test_no_exception_when_bjobs_does_not_exist(caplog, job_name): + caplog.set_level(logging.DEBUG) + driver = LsfDriver( + bjobs_cmd="/bin_foo/not_existing", bhist_cmd="/bin_bar/not_existing" + ) + driver._poll_period = 0.01 + await driver.submit(0, "sh", "-c", "sleep 1", name=job_name) + await poll(driver, {0}) + print("waiting..") + await asyncio.sleep(1) + print(caplog.text) + + @pytest.mark.integration_test async def test_that_kill_before_submit_is_finished_works(tmp_path, monkeypatch, caplog): """This test asserts that it is possible to issue a kill command