Skip to content

Commit

Permalink
Allow the bhist command to be temporarily unavailable
Browse files Browse the repository at this point in the history
This makes the handling of a FileNotFoundError on bhist similar to the handling of
FileNotFoundError from bjobs. It is important not to crash on potentially intermittent
failures in code that is rerun every 2 seconds.
  • Loading branch information
berland committed Jan 10, 2025
1 parent 102ad15 commit 791fd8d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/ert/scheduler/lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,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(
Expand Down

0 comments on commit 791fd8d

Please sign in to comment.