Skip to content

Commit 74b3839

Browse files
committed
move first field into strategy executor state, out of job status poller
this should not change behaviour
1 parent cd83b98 commit 74b3839

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

parsl/jobs/job_status_poller.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class PolledExecutorFacade:
1919
def __init__(self, executor: BlockProviderExecutor, dfk: Optional["parsl.dataflow.dflow.DataFlowKernel"] = None):
2020
self._executor = executor
2121
self._dfk = dfk
22-
self.first = True
2322

2423
# Create a ZMQ channel to send poll status to monitoring
2524
self.monitoring_enabled = False

parsl/jobs/strategy.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class ExecutorState(TypedDict):
2626
If the executor is not idle, then None.
2727
"""
2828

29+
first: bool
30+
"""Is this the first poll for this executor?
31+
"""
32+
2933

3034
class Strategy:
3135
"""Scaling strategy.
@@ -144,17 +148,17 @@ def __init__(self, *, strategy: Optional[str], max_idletime: float) -> None:
144148

145149
def add_executors(self, executors: Sequence[ParslExecutor]) -> None:
146150
for executor in executors:
147-
self.executors[executor.label] = {'idle_since': None}
151+
self.executors[executor.label] = {'idle_since': None, 'first': True}
148152

149153
def _strategy_init_only(self, status_list: List[jsp.PolledExecutorFacade]) -> None:
150154
"""Scale up to init_blocks at the start, then nothing more.
151155
"""
152156
for exec_status in status_list:
153-
if exec_status.first:
154-
executor = exec_status.executor
157+
executor = exec_status.executor
158+
if self.executors[executor.label]['first']:
155159
logger.debug(f"strategy_init_only: scaling out {executor.provider.init_blocks} initial blocks for {executor.label}")
156160
exec_status.scale_out(executor.provider.init_blocks)
157-
exec_status.first = False
161+
self.executors[executor.label]['first'] = False
158162
else:
159163
logger.debug("strategy_init_only: doing nothing")
160164

@@ -190,11 +194,11 @@ def _general_strategy(self, status_list, *, strategy_type):
190194
continue
191195
logger.debug(f"Strategizing for executor {label}")
192196

193-
if exec_status.first:
197+
if self.executors[label]['first']:
194198
executor = exec_status.executor
195199
logger.debug(f"Scaling out {executor.provider.init_blocks} initial blocks for {label}")
196200
exec_status.scale_out(executor.provider.init_blocks)
197-
exec_status.first = False
201+
self.executors[label]['first'] = False
198202

199203
# Tasks that are either pending completion
200204
active_tasks = executor.outstanding

0 commit comments

Comments
 (0)