Skip to content

Commit 87aa430

Browse files
committed
push cache refresh state into executor
this should not change behaviour, but is prep for next patch that does change behaviour it does not change behaviour because it is only moving attributes into different objects
1 parent 5480e9d commit 87aa430

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

parsl/executors/status_handling.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def __init__(self, *,
7373
self.blocks_to_job_id = {} # type: Dict[str, str]
7474
self.job_ids_to_block = {} # type: Dict[str, str]
7575

76+
self._last_poll_time = 0.0
77+
7678
def _make_status_dict(self, block_ids: List[str], status_list: List[JobStatus]) -> Dict[str, JobStatus]:
7779
"""Given a list of block ids and a list of corresponding status strings,
7880
returns a dictionary mapping each block id to the corresponding status
@@ -236,3 +238,6 @@ def _get_block_and_job_ids(self) -> Tuple[List[str], List[Any]]:
236238
@abstractproperty
237239
def workers_per_node(self) -> Union[int, float]:
238240
pass
241+
242+
def _should_poll(self, now: float) -> bool:
243+
return now >= self._last_poll_time + self.status_polling_interval

parsl/jobs/job_status_poller.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class PolledExecutorFacade:
2020
def __init__(self, executor: BlockProviderExecutor, dfk: Optional["parsl.dataflow.dflow.DataFlowKernel"] = None):
2121
self._executor = executor
2222
self._dfk = dfk
23-
self._interval = executor.status_polling_interval
24-
self._last_poll_time = 0.0
2523
self.first = True
2624

2725
# Create a ZMQ channel to send poll status to monitoring
@@ -36,15 +34,12 @@ def __init__(self, executor: BlockProviderExecutor, dfk: Optional["parsl.dataflo
3634
self.hub_channel.connect("tcp://{}:{}".format(hub_address, hub_port))
3735
logger.info("Monitoring enabled on job status poller")
3836

39-
def _should_poll(self, now: float) -> bool:
40-
return now >= self._last_poll_time + self._interval
41-
4237
def poll(self, now: float) -> None:
4338
previous_status = self.executor._poller_mutable_status
4439

45-
if self._should_poll(now):
40+
if self.executor._should_poll(now):
4641
self.executor._poller_mutable_status = self._executor.status()
47-
self._last_poll_time = now
42+
self.executor._last_poll_time = now
4843

4944
if previous_status != self.executor._poller_mutable_status:
5045
# short circuit the case where the two objects are identical so

0 commit comments

Comments
 (0)