Skip to content

Commit eca0bc1

Browse files
dulinrileymeta-codesync[bot]
authored andcommitted
Make v0 and v1 ControllerController.get_or_spawn have compatible signatures (#1621)
Summary: Pull Request resolved: #1621 The v0 and v1 ControllerController.get_or_spawn endpoints need to have matching signatures. v1 added a "self_ref" for the actor mesh. v0 doesn't need it but can easily get it and not use it. Reviewed By: samlurye Differential Revision: D85068507 fbshipit-source-id: b839c2bca2efcd7b285b521ab46ebb1da870af06
1 parent ac36647 commit eca0bc1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

python/monarch/_src/actor/proc_mesh.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,12 @@ def __init__(self) -> None:
857857
# pyre-ignore
858858
@endpoint
859859
def get_or_spawn(
860-
self, name: str, Class: Type[_ActorType], *args: Any, **kwargs: Any
860+
self,
861+
self_ref: "_ControllerControllerV0",
862+
name: str,
863+
Class: Type[_ActorType],
864+
*args: Any,
865+
**kwargs: Any,
861866
) -> _ActorType:
862867
if name not in self._controllers:
863868
proc_mesh = _proc_mesh_from_allocator(
@@ -910,9 +915,8 @@ def get_or_spawn_controller_v0(
910915
Returns:
911916
A Future that resolves to a reference to the actor.
912917
"""
913-
return context().actor_instance._controller_controller.get_or_spawn.call_one(
914-
name, Class, *args, **kwargs
915-
)
918+
cc = context().actor_instance._controller_controller
919+
return cc.get_or_spawn.call_one(cc, name, Class, *args, **kwargs)
916920

917921

918922
if v1_enabled or TYPE_CHECKING:

0 commit comments

Comments
 (0)