Skip to content

Commit f1b30ee

Browse files
authored
Make executor.connected_workers a regular method (#3917)
See PR #3915 for related justification on the same change for executor.outstanding() In the connected_workers case, for High Throughput Executor, an RPC to the interchange is made when this attribute is accessed, which is execptionally high failure risk and has personally caused me a lot of trouble in understanding previously. # Changed Behaviour User code that is accessing connected workers will have to switch to method syntax, from attribute syntax. ## Type of change - Code maintenance/cleanup
1 parent f9210c4 commit f1b30ee

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

parsl/executors/high_throughput/executor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ def outstanding(self) -> int:
626626
and managers"""
627627
return len(self.tasks)
628628

629-
@property
630629
def connected_workers(self) -> int:
631630
"""Returns the count of workers across all connected managers"""
632631
return self.command_client.run("WORKERS")

parsl/jobs/strategy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def _general_strategy(self, executors: List[BlockProviderExecutor], *, strategy_
215215

216216
if hasattr(executor, 'connected_workers'):
217217
logger.debug('Executor {} has {} active tasks, {}/{} running/pending blocks, and {} connected workers'.format(
218-
label, active_tasks, running, pending, executor.connected_workers))
218+
label, active_tasks, running, pending, executor.connected_workers()))
219219
else:
220220
logger.debug('Executor {} has {} active tasks and {}/{} running/pending blocks'.format(
221221
label, active_tasks, running, pending))

parsl/tests/manual_tests/test_memory_limits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_simple(mem_per_worker):
5353
# Prime a worker
5454
double(5).result()
5555
dfk = parsl.dfk()
56-
connected = dfk.executors['htex_local'].connected_workers
56+
connected = dfk.executors['htex_local'].connected_workers()
5757
print("Connected : ", connected)
5858
assert expected_workers == connected, "Expected {} workers, instead got {} workers".format(expected_workers,
5959
connected)

parsl/tests/site_tests/test_site.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_platform(n=2, sleep_dur=10):
3535
print([i.result() for i in x])
3636

3737
print("Executor : ", dfk.executors[name])
38-
print("Connected : ", dfk.executors[name].connected_workers)
38+
print("Connected : ", dfk.executors[name].connected_workers())
3939
print("Outstanding : ", dfk.executors[name].outstanding())
4040

4141
d = []

0 commit comments

Comments
 (0)