Skip to content

Commit

Permalink
Merge pull request #1 from goodboy/drop-trip-update-trio
Browse files Browse the repository at this point in the history
Drop trip update trio
  • Loading branch information
Guillermo Rodriguez authored Jul 21, 2020
2 parents 772f9c3 + 409ceef commit 2b09818
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/test_cancellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async def test_cancel_infinite_streamer(start_method):
],
)
@tractor_test
async def test_some_cancels_all(num_actors_and_errs, start_method):
async def test_some_cancels_all(num_actors_and_errs, start_method, loglevel):
"""Verify a subset of failed subactors causes all others in
the nursery to be cancelled just like the strategy in trio.
Expand Down
2 changes: 1 addition & 1 deletion tractor/_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def load_modules(self) -> None:
code (if it exists).
"""
try:
if self._spawn_method == 'trio_run_in_process':
if self._spawn_method == 'trio':
parent_data = self._parent_main_data
if 'init_main_from_name' in parent_data:
_mp_fixup_main._fixup_main_from_name(
Expand Down
12 changes: 12 additions & 0 deletions tractor/_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ async def _trio_main(
accept_addr: Tuple[str, int],
parent_addr: Tuple[str, int] = None
) -> None:
"""Entry point for a `trio_run_in_process` subactor.
Here we don't need to call `trio.run()` since trip does that as
part of its subprocess startup sequence.
"""
if actor.loglevel is not None:
log.info(
f"Setting loglevel for {actor.uid} to {actor.loglevel}")
get_console_log(actor.loglevel)

log.info(f"Started new trio process for {actor.uid}")

_state._current_actor = actor

await actor._async_main(accept_addr, parent_addr=parent_addr)
log.info(f"Actor {actor.uid} terminated")
4 changes: 3 additions & 1 deletion tractor/_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,13 @@ async def run_in_process(async_fn, *args, **kwargs):
stdin=subprocess.PIPE
)

# send over func to call
await p.stdin.send_all(encoded_job)

yield p

#return cloudpickle.loads(p.stdout)
# wait for termination
await p.wait()


async def new_proc(
Expand Down

0 comments on commit 2b09818

Please sign in to comment.