Skip to content

Commit

Permalink
Make sure to log Realization status after completed run as info (#8074)
Browse files Browse the repository at this point in the history
* Make sure to log Realization status after completed run as info

* Change logger.error to logger.info when kill does not execute

* Set log_level to INFO in test
  • Loading branch information
xjules committed Jun 6, 2024
1 parent 90f7b66 commit 77ff126
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/ert/scheduler/local_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def _run(self, iens: int, executable: str, /, *args: str) -> None:
returncode = 0
try:
returncode = await self._wait(proc)
logger.debug(f"Realization {iens} finished with {returncode=}")
logger.info(f"Realization {iens} finished with {returncode=}")
except asyncio.CancelledError:
returncode = await self._kill(proc)
finally:
Expand Down
8 changes: 3 additions & 5 deletions src/ert/scheduler/lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ async def submit(

async def kill(self, iens: int) -> None:
if iens not in self._iens2jobid:
logger.error(f"LSF kill failed due to missing jobid for realization {iens}")
logger.info(f"LSF kill failed due to missing jobid for realization {iens}")
return

job_id = self._iens2jobid[iens]
Expand Down Expand Up @@ -400,14 +400,12 @@ async def _process_job_update(self, job_id: str, new_state: AnyJob) -> None:
logger.debug(f"Realization {iens} is running")
event = StartedEvent(iens=iens)
elif isinstance(new_state, FinishedJobFailure):
logger.debug(
f"Realization {iens} (LSF-id: {self._iens2jobid[iens]}) failed"
)
logger.info(f"Realization {iens} (LSF-id: {self._iens2jobid[iens]}) failed")
exit_code = await self._get_exit_code(job_id)
event = FinishedEvent(iens=iens, returncode=exit_code)

elif isinstance(new_state, FinishedJobSuccess):
logger.debug(
logger.info(
f"Realization {iens} (LSF-id: {self._iens2jobid[iens]}) succeeded"
)
event = FinishedEvent(iens=iens, returncode=0)
Expand Down
6 changes: 3 additions & 3 deletions src/ert/scheduler/openpbs_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async def kill(self, iens: int) -> None:
return

if iens not in self._iens2jobid:
logger.error(f"PBS kill failed due to missing jobid for realization {iens}")
logger.info(f"PBS kill failed due to missing jobid for realization {iens}")
return

job_id = self._iens2jobid[iens]
Expand Down Expand Up @@ -330,11 +330,11 @@ async def _process_job_update(self, job_id: str, new_state: AnyJob) -> None:
)

if new_state.returncode != 0:
logger.debug(
logger.info(
f"Realization {iens} (PBS-id: {self._iens2jobid[iens]}) failed"
)
else:
logger.debug(
logger.info(
f"Realization {iens} (PBS-id: {self._iens2jobid[iens]}) succeeded"
)
self._finished_iens.add(iens)
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/scheduler/test_lsf_driver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import logging
import os
import stat
import time
Expand Down Expand Up @@ -370,6 +371,7 @@ async def test_kill(
expected_logged_error,
caplog,
):
caplog.set_level(logging.INFO)
monkeypatch.chdir(tmp_path)
bin_path = Path("bin")
bin_path.mkdir()
Expand Down

0 comments on commit 77ff126

Please sign in to comment.