Skip to content

Commit

Permalink
Fix issues highlighted by pyright
Browse files Browse the repository at this point in the history
Added one if that is actually needed and made a change to make pyright
happy even though it was not a real problem.
  • Loading branch information
JHolba committed Sep 3, 2024
1 parent de9d63a commit fc846ba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/_ert_forward_model_runner/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,10 @@ def run(self): # noqa: PLR0912, PLR0915
stdout = None

target_file = self.job_data.get("target_file")
if target_file:
target_file_mtime: int = 0
if os.path.exists(target_file):
stat = os.stat(target_file)
target_file_mtime = stat.st_mtime_ns
target_file_mtime: int = 0
if target_file and os.path.exists(target_file):
stat = os.stat(target_file)
target_file_mtime = stat.st_mtime_ns

max_running_minutes = self.job_data.get("max_running_minutes")
run_start_time = dt.now()
Expand Down Expand Up @@ -166,7 +165,8 @@ def ensure_file_handles_closed():
f"Most likely you are missing and should add "
f"'#!/usr/bin/env python' to the top of the file: "
)
stderr.write(msg)
if stderr:
stderr.write(msg)
ensure_file_handles_closed()
yield Exited(self, e.errno).with_error(msg)
return
Expand Down Expand Up @@ -368,8 +368,8 @@ def _get_rss_and_oom_score_for_processtree(
"""

oom_score = None
memory_rss = 0
# A value of None means that we have no information.
memory_rss = 0
with contextlib.suppress(ValueError, FileNotFoundError):
oom_score = int(
Path(f"/proc/{process.pid}/oom_score").read_text(encoding="utf-8")
Expand Down

0 comments on commit fc846ba

Please sign in to comment.