Skip to content

Commit

Permalink
Remove ExecutorStatus abstract class (#2835)
Browse files Browse the repository at this point in the history
This removes the ExecutorStatus abstract class, instead using its only concrete implementation PollItem everywhere that ExecutorStatus was previously used.

This requires some circular imports to let type annotations work - some now annotate some things as PollItem rather than ExecutorStatus. This is done using from __future__ import annotations and import rather than from ... import ...
  • Loading branch information
benclifford authored Jul 20, 2023
1 parent c39700b commit 385fa3b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
16 changes: 0 additions & 16 deletions parsl/dataflow/executor_status.py

This file was deleted.

9 changes: 6 additions & 3 deletions parsl/dataflow/job_error_handler.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from __future__ import annotations

from typing import List, Dict

from parsl.dataflow.executor_status import ExecutorStatus
import parsl.dataflow.job_status_poller as jsp

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[jsp.PollItem]):
for es in status:
self._check_irrecoverable_executor(es)

def _check_irrecoverable_executor(self, es: ExecutorStatus):
def _check_irrecoverable_executor(self, es: jsp.PollItem):
if not es.executor.error_management_enabled:
return
es.executor.handle_errors(self, es.status)
Expand Down
4 changes: 2 additions & 2 deletions parsl/dataflow/job_status_poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Dict, Sequence
from typing import List # noqa F401 (used in type annotation)

from parsl.dataflow.executor_status import ExecutorStatus
from parsl.dataflow.job_error_handler import JobErrorHandler
from parsl.dataflow.strategy import Strategy
from parsl.executors.base import ParslExecutor
Expand All @@ -15,10 +14,11 @@

from parsl.utils import Timer


logger = logging.getLogger(__name__)


class PollItem(ExecutorStatus):
class PollItem:
def __init__(self, executor: ParslExecutor, dfk: "parsl.dataflow.dflow.DataFlowKernel"):
self._executor = executor
self._dfk = dfk
Expand Down
6 changes: 4 additions & 2 deletions parsl/dataflow/strategy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from __future__ import annotations
import logging
import time
import math
import warnings
from typing import Dict, List, Optional

from parsl.dataflow.executor_status import ExecutorStatus
import parsl.dataflow.job_status_poller as jsp

from parsl.executors import HighThroughputExecutor
from parsl.executors.base import ParslExecutor
from parsl.executors.status_handling import BlockProviderExecutor
Expand Down Expand Up @@ -134,7 +136,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[jsp.PollItem]) -> None:
"""Do nothing.
"""
logger.debug("strategy_noop: doing nothing")
Expand Down

0 comments on commit 385fa3b

Please sign in to comment.