Skip to content

Commit 7241f29

Browse files
authored
Update signature to match underlying resource (#3775)
`TaskScheduler` is a do-nothing shim over `mp.Queue`, only standing as hook-in point for `MPITaskScheduler`. In both cases, there is no need to mask the `Queue`'s fundamentals semantics. # Changed Behaviour No changed behaviour. ## Type of change - Code maintenance/cleanup
1 parent 3907e63 commit 7241f29

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

parsl/executors/high_throughput/mpi_resource_management.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import queue
66
import subprocess
77
from enum import Enum
8-
from typing import Dict, List
8+
from typing import Dict, List, Optional
99

1010
from parsl.multiprocessing import SpawnContext
1111
from parsl.serialize import pack_res_spec_apply_message, unpack_res_spec_apply_message
@@ -86,8 +86,8 @@ def __init__(
8686
def put_task(self, task) -> None:
8787
return self.pending_task_q.put(task)
8888

89-
def get_result(self, block: bool, timeout: float):
90-
return self.pending_result_q.get(block, timeout=timeout)
89+
def get_result(self, block: bool = True, timeout: Optional[float] = None):
90+
return self.pending_result_q.get(block, timeout)
9191

9292

9393
class MPITaskScheduler(TaskScheduler):
@@ -191,9 +191,9 @@ def _schedule_backlog_tasks(self):
191191
# Keep attempting to schedule tasks till we are out of resources
192192
self._schedule_backlog_tasks()
193193

194-
def get_result(self, block: bool, timeout: float):
194+
def get_result(self, block: bool = True, timeout: Optional[float] = None):
195195
"""Return result and relinquish provisioned nodes"""
196-
result_pkl = self.pending_result_q.get(block, timeout=timeout)
196+
result_pkl = self.pending_result_q.get(block, timeout)
197197
result_dict = pickle.loads(result_pkl)
198198
# TODO (wardlt): If the task did not request nodes, it won't be in `self._map_tasks_to_nodes`.
199199
# Causes Parsl to hang. See Issue #3427

0 commit comments

Comments
 (0)