Clarify `run()` actor lifetime management
`run()` described its actor-selection kwargs as placement controls, but they determine who owns the actor lifetime and whether an existing actor is reused or a new one is spawned. Use lifetime-management terminology in the parameter comments and docstring, and identify the existing-actor handle as `portal: Portal`. Review: PR #481 (goodboy) https://github.com/goodboy/tractor/pull/481#pullrequestreview-5012942328 (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))wkt/to_actor_subpkg
parent
9373e9434d
commit
617ca1de43
|
|
@ -240,8 +240,8 @@ async def run(
|
|||
fn: Callable[[Unpack[ArgsT]], Awaitable[RetT]],
|
||||
*args: Unpack[ArgsT],
|
||||
|
||||
# actor "placement": reuse an already-running peer
|
||||
# via its `portal`, spawn a fresh subactor from
|
||||
# actor lifetime management: reuse an already-running peer
|
||||
# via its `portal: Portal`, spawn a fresh subactor from
|
||||
# a caller-managed `an: ActorNursery`, or, when
|
||||
# neither is provided, open a private actor-nursery
|
||||
# (implicitly booting the actor-runtime as needed)
|
||||
|
|
@ -275,9 +275,10 @@ async def run(
|
|||
|
||||
As with Trio's API, target arguments are positional. Use
|
||||
`functools.partial()` to bind target keyword arguments; all
|
||||
keyword arguments accepted here configure actor placement or
|
||||
spawning. A caller-supplied `portal` must address an actor started
|
||||
with both `tractor.to_actor.MODULE` and the target function's
|
||||
keyword arguments accepted here configure actor lifetime
|
||||
management, including actor reuse and spawning. A caller-supplied
|
||||
`portal` must address an actor started with both
|
||||
`tractor.to_actor.MODULE` and the target function's
|
||||
module in its `enable_modules` list. Calls that spawn their own
|
||||
actor add the trampoline module automatically.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue