forked from goodboy/tractor
1
0
Fork 0
'structured concurrent `trio`-"actors"'
Go to file
Tyler Goodlet bb13b79df5 Drop the "main" task via kwarg idea
Stop worrying about a "main task" in each actor and instead add an
additional `ActorNursery.run_in_actor()` method which wraps calls
to create an actor and run a lone RPC task inside it. Note this
adjusts the public API of `ActorNursery.start_actor()` to drop
its `main` kwarg.

The dirty deats of making this possible:
- each spawned RPC task is now tracked with a specific cancel scope such
  that when the actor is cancelled all ongoing responders are cancelled
  before any IPC/channel machinery is closed (turns out that spawning
  new actors from `outlive_main=True` actors was probably borked before
  finally getting this working).
- make each initial RPC response be a packet which describes the
  `functype` (eg. `{'functype': 'asyncfunction'}`) allowing for async
  calls/submissions by client actors (this was required to make
  `run_in_actor()` work - `Portal._submit()` is the new async method).
- hooray we can stop faking "main task" results for daemon actors
- add better handling/raising of internal errors caught in the bowels of
  the `Actor` itself.
- drop the rpc spawning nursery; just use the `Actor._root_nursery`
- only wait on `_no_more_peers` if there are existing peer channels that
  are actually still connected.
- an `ActorNursery.__aexit__()` now implicitly waits on `Portal.result()` on close
  for each `run_in_actor()` spawned actor.
- handle cancelling partial started actors which haven't yet connected
  back to the parent

Resolves #24
2018-08-02 15:24:28 -04:00
tests Reorg everything into private modules 2018-07-14 16:09:05 -04:00
tractor Drop the "main" task via kwarg idea 2018-08-02 15:24:28 -04:00
.gitignore Initial commit 2018-07-05 16:01:15 -04:00
.travis.yml Add initial travis file 2018-07-11 22:32:54 -04:00
LICENSE Initial commit 2018-07-05 16:01:15 -04:00
README.md Initial commit 2018-07-05 16:01:15 -04:00
requirements-test.txt Add trio plugin for testing 2018-07-11 22:20:13 -04:00
setup.py Add trio framework classifier 2018-07-10 17:27:47 -04:00

README.md

tractor

async, multicore, distributed Python built on trio