Drop tractor.run() from docs

drop_run
Tyler Goodlet 2021-02-24 14:30:30 -05:00
parent 98a0594c26
commit a54260a67e
1 changed files with 16 additions and 5 deletions

View File

@ -145,7 +145,7 @@ and use the ``run_in_actor()`` method:
What's going on? What's going on?
- an initial *actor* is started with ``tractor.run()`` and told to execute - an initial *actor* is started with ``trio.run()`` and told to execute
its main task_: ``main()`` its main task_: ``main()``
- inside ``main()`` an actor is *spawned* using an ``ActorNusery`` and is told - inside ``main()`` an actor is *spawned* using an ``ActorNusery`` and is told
@ -458,7 +458,7 @@ find an actor's socket address by name use the ``find_actor()`` function:
.. literalinclude:: ../examples/service_discovery.py .. literalinclude:: ../examples/service_discovery.py
The ``name`` value you should pass to ``find_actor()`` is the one you passed as the The ``name`` value you should pass to ``find_actor()`` is the one you passed as the
*first* argument to either ``tractor.run()`` or ``ActorNursery.start_actor()``. *first* argument to either ``trio.run()`` or ``ActorNursery.start_actor()``.
Running actors standalone Running actors standalone
@ -472,7 +472,17 @@ need to hop into a debugger. You just need to pass the existing
.. code:: python .. code:: python
tractor.run(main, arbiter_addr=('192.168.0.10', 1616)) import trio
import tractor
async def main():
async with tractor.open_root_actor(
arbiter_addr=('192.168.0.10', 1616)
):
await trio.sleep_forever()
trio.run(main)
Choosing a process spawning backend Choosing a process spawning backend
@ -480,7 +490,7 @@ Choosing a process spawning backend
``tractor`` is architected to support multiple actor (sub-process) ``tractor`` is architected to support multiple actor (sub-process)
spawning backends. Specific defaults are chosen based on your system spawning backends. Specific defaults are chosen based on your system
but you can also explicitly select a backend of choice at startup but you can also explicitly select a backend of choice at startup
via a ``start_method`` kwarg to ``tractor.run()``. via a ``start_method`` kwarg to ``tractor.open_nursery()``.
Currently the options available are: Currently the options available are:
@ -536,13 +546,14 @@ main python module of the program:
.. code:: python .. code:: python
# application/__main__.py # application/__main__.py
import trio
import tractor import tractor
import multiprocessing import multiprocessing
from . import tractor_app from . import tractor_app
if __name__ == '__main__': if __name__ == '__main__':
multiprocessing.freeze_support() multiprocessing.freeze_support()
tractor.run(tractor_app.main) trio.run(tractor_app.main)
And execute as:: And execute as::