Skip to content

Commit 3a916e6

Browse files
committed
fixes slice logic for fetcher
1 parent 47cb0ab commit 3a916e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/forge/controller/provisioner.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ async def get_remote_info(host_mesh: HostMesh) -> tuple[str, str]:
4848
"""Returns the host name and port of the host mesh."""
4949
throwaway_procs = host_mesh.spawn_procs(per_host={"procs": 1})
5050
fetcher = throwaway_procs.spawn("_fetcher", _RemoteInfoFetcher)
51-
fetcher = fetcher.slice(procs=0)
51+
52+
# This will reduce something like extent = {"hosts": 2, "procs": 1} to
53+
# {"hosts": 1, "procs": 1}.
54+
singleton_slice = {k: slice(0, 1) for k in fetcher.extent.keys()}
55+
fetcher = fetcher.slice(**singleton_slice)
56+
# Fetcher should be a singleton at this point - call_one() will fail otherwise
57+
5258
host, port = await fetcher.get_info.call_one()
5359
await throwaway_procs.stop()
5460
return host, port

0 commit comments

Comments
 (0)