Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Feb 11, 2025
1 parent dd6c0c1 commit 0f72bed
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions cylc/flow/job_runner_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import sys
import traceback
from typing import (
TYPE_CHECKING,
List,
Optional,
)
Expand All @@ -61,22 +62,27 @@
from cylc.flow.wallclock import get_current_time_string


if TYPE_CHECKING:
from typing_extensions import Literal


@dataclass
class JobPollContext:
"""Context object for a job poll."""
job_log_dir: str # cycle/task/submit_num
job_runner_name: Optional[str] = None
job_id = None # job id in job runner
job_runner_exit_polled: Optional[int] = None # 0 for false, 1 for true
run_status: Optional[int] = None # 0 for success, 1 for failure
job_id: Optional[str] = None # job id in job runner
# Has exited job runner? 0 for false, 1 for true:
job_runner_exit_polled: 'Literal[0, 1, None]' = None
run_status: 'Literal[0, 1, None]' = None # 0 for success, 1 for failure
run_signal: Optional[str] = None # signal received on run failure
time_submit_exit: Optional[str] = None # submit (exit) time
time_run: Optional[str] = None # run start time
time_run_exit: Optional[str] = None # run exit time
job_runner_call_no_lines = None # line count in job runner call stdout

def __post_init__(self):
self.pid = None
self.pid: Optional[str] = None
self.messages: List[str] = []

Check warning on line 86 in cylc/flow/job_runner_mgr.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/job_runner_mgr.py#L85-L86

Added lines #L85 - L86 were not covered by tests

def update(self, other: 'JobPollContext') -> None:
Expand Down Expand Up @@ -238,8 +244,11 @@ def jobs_poll(self, job_log_root, job_log_dirs):
# We can trust:
# * Jobs previously polled to have exited the job runner.
# * Jobs succeeded or failed with ERR/EXIT.
if (ctx.job_runner_exit_polled or ctx.run_status == 0 or
ctx.run_signal in ["ERR", "EXIT"]):
if (
ctx.job_runner_exit_polled
or ctx.run_status == 0
or ctx.run_signal in {"ERR", "EXIT"}
):
continue

if ctx.job_runner_name not in ctx_list_by_job_runner:
Expand Down

0 comments on commit 0f72bed

Please sign in to comment.