9292 from monarch ._rust_bindings .monarch_hyperactor .actor_mesh import ActorMeshProtocol
9393 from monarch ._rust_bindings .monarch_hyperactor .mailbox import PortReceiverBase
9494 from monarch ._src .actor .proc_mesh import _ControllerController , ProcMesh
95+ from monarch ._src .actor .v1 .proc_mesh import (
96+ _ControllerController as _ControllerControllerV1 ,
97+ ProcMesh as ProcMeshV1 ,
98+ )
9599from monarch ._src .actor .telemetry import get_monarch_tracer
96100
97101CallMethod = PythonMessageKind .CallMethod
@@ -142,7 +146,7 @@ def actor_id(self) -> ActorId:
142146 ...
143147
144148 @property
145- def proc (self ) -> "ProcMesh" :
149+ def proc (self ) -> "ProcMesh | ProcMeshV1 " :
146150 """
147151 The singleton proc mesh that corresponds to just this actor.
148152 """
@@ -155,14 +159,14 @@ def proc(self) -> "ProcMesh":
155159 The actors __init__ message.
156160 """
157161 rank : Point
158- proc_mesh : "ProcMesh"
159- _controller_controller : "_ControllerController"
162+ proc_mesh : "ProcMesh | ProcMeshV1 "
163+ _controller_controller : "_ControllerController | _ControllerControllerV1 "
160164
161165 # this property is used to hold the handles to actors and processes launched by this actor
162166 # in order to keep them alive until this actor exits.
163- _children : "Optional[List[ActorMesh | ProcMesh]]"
167+ _children : "Optional[List[ActorMesh | ProcMesh | ProcMeshV1 ]]"
164168
165- def _add_child (self , child : "ActorMesh | ProcMesh" ) -> None :
169+ def _add_child (self , child : "ActorMesh | ProcMesh | ProcMeshV1 " ) -> None :
166170 if self ._children is None :
167171 self ._children = [child ]
168172 else :
@@ -212,13 +216,16 @@ def context() -> Context:
212216 if c is None :
213217 c = Context ._root_client_context ()
214218 _context .set (c )
219+
220+ # FIXME: Switch to the v1 APIs when it becomes the default.
215221 from monarch ._src .actor .host_mesh import create_local_host_mesh
216222 from monarch ._src .actor .proc_mesh import _get_controller_controller
217223
218224 c .actor_instance .proc_mesh , c .actor_instance ._controller_controller = (
219225 _get_controller_controller ()
220226 )
221- c .actor_instance .proc_mesh ._host_mesh = create_local_host_mesh ()
227+
228+ c .actor_instance .proc_mesh ._host_mesh = create_local_host_mesh () # type: ignore
222229 return c
223230
224231
@@ -281,7 +288,7 @@ def __init__(
281288 self ,
282289 actor_mesh : "ActorMeshProtocol" ,
283290 shape : Shape ,
284- proc_mesh : "Optional[ProcMesh]" ,
291+ proc_mesh : "Optional[ProcMesh] | Optional[ProcMeshV1] " ,
285292 name : MethodSpecifier ,
286293 impl : Callable [Concatenate [Any , P ], Awaitable [R ]],
287294 propagator : Propagator ,
@@ -931,7 +938,7 @@ def __init__(
931938 Class : Type [T ],
932939 inner : "ActorMeshProtocol" ,
933940 shape : Shape ,
934- proc_mesh : "Optional[ProcMesh]" ,
941+ proc_mesh : "Optional[ProcMesh] | Optional[ProcMeshV1] " ,
935942 ) -> None :
936943 self .__name__ : str = Class .__name__
937944 self ._class : Type [T ] = Class
@@ -986,8 +993,9 @@ def _create(
986993 Class : Type [T ],
987994 actor_mesh : "PythonActorMesh" ,
988995 shape : Shape ,
989- proc_mesh : "ProcMesh" ,
990- controller_controller : Optional ["_ControllerController" ],
996+ proc_mesh : "ProcMesh | ProcMeshV1" ,
997+ controller_controller : Optional ["_ControllerController" ]
998+ | Optional ["_ControllerControllerV1" ],
991999 # args and kwargs are passed to the __init__ method of the user defined
9921000 # python actor object.
9931001 * args : Any ,
@@ -1019,7 +1027,7 @@ def from_actor_id(
10191027 return cls (Class , _SingletonActorAdapator (actor_id ), singleton_shape , None )
10201028
10211029 def __reduce_ex__ (self , protocol : ...) -> "Tuple[Type[ActorMesh], Tuple[Any, ...]]" :
1022- return ActorMesh , (self ._class , self ._inner , self ._shape , None )
1030+ return ActorMesh , (self ._class , self ._inner , self ._shape , self . _proc_mesh )
10231031
10241032 @property
10251033 def _ndslice (self ) -> NDSlice :
0 commit comments