Skip to content

Commit d5bf865

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 ad315a2 commit d5bf865

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
class PolledExecutorFacade:
1919
def __init__(self, executor: BlockProviderExecutor, monitoring: Optional["parsl.monitoring.radios.MonitoringRadio"] = None):
2020
self._executor = executor
21-
self._last_poll_time = 0.0
2221
self._monitoring = monitoring
2322

2423
def poll(self) -> None:
2524
now = time.time()
2625
previous_status = self.executor._poller_mutable_status
2726

28-
if now >= self._last_poll_time + self._executor.status_polling_interval:
27+
if now >= self._executor._last_poll_time + self._executor.status_polling_interval:
2928
self._executor._poller_mutable_status = self._executor.status()
30-
self._last_poll_time = now
29+
self._executor._last_poll_time = now
3130

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

0 commit comments

Comments
 (0)