Skip to content

Commit

Permalink
upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Sep 14, 2023
1 parent c3c275e commit bef0ca9
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 89 deletions.
12 changes: 7 additions & 5 deletions cluster_tools/cluster_tools/executors/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ def map_to_futures(
def map(
self,
fn: Callable[[_S], _T],
args: Iterable[_S], # TODO change: allow more than one arg per call,
timeout=None,
chunksize=1,
):
return list(super().map(fn, args, timeout=timeout, chunksize=chunksize))
*iterables: Iterable[Any],
timeout: Optional[float] = None,
chunksize: int = 1,
) -> Iterator[_T]:
return iter(
list(super().map(fn, *iterables, timeout=timeout, chunksize=chunksize))
)

def forward_log(self, fut: "Future[_T]") -> _T:
return fut.result()
Expand Down
4 changes: 2 additions & 2 deletions cluster_tools/cluster_tools/executors/multiprocessing_.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def __init__(
self._mp_logging_handler_pool = _MultiprocessingLoggingHandlerPool()

@classmethod
def as_completed(cls, futures: List[Future[_T]]) -> Iterator[Future[_T]]:
return futures.as_completed(futures)
def as_completed(cls, futs: List[Future[_T]]) -> Iterator[Future[_T]]:
return futures.as_completed(futs)

def submit( # type: ignore[override]
self,
Expand Down
4 changes: 2 additions & 2 deletions cluster_tools/cluster_tools/schedulers/cluster_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def __init__(
self.meta_data["logging_setup_fn"] = kwargs["logging_setup_fn"]

@classmethod
def as_completed(cls, futures: List[Future[_T]]) -> Iterator[Future[_T]]:
return futures.as_completed(futures)
def as_completed(cls, futs: List[Future[_T]]) -> Iterator[Future[_T]]:
return futures.as_completed(futs)

@classmethod
@abstractmethod
Expand Down
Loading

0 comments on commit bef0ca9

Please sign in to comment.