From 73c3901fc87d26442048e862065857b647388f38 Mon Sep 17 00:00:00 2001 From: Ben Clifford Date: Wed, 19 Jul 2023 19:21:26 +0000 Subject: [PATCH] Remove ExecutorStatus abstraction and push everything into PollItem --- parsl/dataflow/job_error_handler.py | 6 +++--- parsl/dataflow/job_status_poller.py | 15 +-------------- parsl/dataflow/strategy.py | 4 ++-- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/parsl/dataflow/job_error_handler.py b/parsl/dataflow/job_error_handler.py index 88b2bff194..44dfdc0f96 100644 --- a/parsl/dataflow/job_error_handler.py +++ b/parsl/dataflow/job_error_handler.py @@ -1,16 +1,16 @@ from typing import List, Dict -from parsl.dataflow.job_status_poller import ExecutorStatus +from parsl.dataflow.job_status_poller import PollItem from parsl.executors.base import ParslExecutor from parsl.providers.base import JobStatus, JobState class JobErrorHandler: - def run(self, status: List[ExecutorStatus]): + def run(self, status: List[PollItem]): for es in status: self._check_irrecoverable_executor(es) - def _check_irrecoverable_executor(self, es: ExecutorStatus): + def _check_irrecoverable_executor(self, es: PollItem): if not es.executor.error_management_enabled: return es.executor.handle_errors(self, es.status) diff --git a/parsl/dataflow/job_status_poller.py b/parsl/dataflow/job_status_poller.py index fddc687425..bca811e351 100644 --- a/parsl/dataflow/job_status_poller.py +++ b/parsl/dataflow/job_status_poller.py @@ -18,20 +18,7 @@ logger = logging.getLogger(__name__) - -class ExecutorStatus(metaclass=ABCMeta): - @property - @abstractmethod - def executor(self) -> "parsl.executors.base.ParslExecutor": - pass - - @property - @abstractmethod - def status(self) -> Dict[str, "parsl.providers.base.JobStatus"]: - pass - - -class PollItem(ExecutorStatus): +class PollItem: def __init__(self, executor: ParslExecutor, dfk: "parsl.dataflow.dflow.DataFlowKernel"): self._executor = executor self._dfk = dfk diff --git a/parsl/dataflow/strategy.py b/parsl/dataflow/strategy.py index 788fd38f61..23ae8132f9 100644 --- a/parsl/dataflow/strategy.py +++ b/parsl/dataflow/strategy.py @@ -4,7 +4,7 @@ import warnings from typing import Dict, List, Optional -from parsl.dataflow.job_status_poller import ExecutorStatus +from parsl.dataflow.job_status_poller import PollItem from parsl.executors import HighThroughputExecutor from parsl.executors.base import ParslExecutor from parsl.executors.status_handling import BlockProviderExecutor @@ -134,7 +134,7 @@ def add_executors(self, executors): for executor in executors: self.executors[executor.label] = {'idle_since': None} - def _strategy_noop(self, status: List[ExecutorStatus]) -> None: + def _strategy_noop(self, status: List[PollItem]) -> None: """Do nothing. """ logger.debug("strategy_noop: doing nothing")