hilevel.ServiceMngr from piker #12

Open
goodboy wants to merge 4 commits from hilevel_serman into ext_type_plds

Factoring out what was the piker.service._mngr module (+ improvements, comments, and todos) into a new tractor.hilevel subpkg.


Main goals/intentions

  • more rigorous test suite
Factoring out what was the `piker.service._mngr` module (+ improvements, comments, and todos) into a new `tractor.hilevel` subpkg. --- #### Main goals/intentions - [ ] more rigorous test suite
goodboy added 4 commits 2025-03-16 23:12:27 +00:00
b01cf136f6 Mv over `ServiceMngr` from `piker` with mods
Namely distinguishing service "IPC contexts" (opened in a
subactor via a `Portal`) from just local `trio.Task`s started
and managed under the `.service_n` (more or less wrapping in the
interface of a "task-manager" style nursery - aka a one-cancels-one
supervision start).

API changes from original (`piker`) impl,
- mk `.start_service_task()` do ONLY that, start a task with a wrapping
  cancel-scope and completion event.
  |_ ideally this gets factored-out/re-implemented using the
    task-manager/OCO-style-nursery from GH #363.
- change what was the impl of `.start_service_task()` to `.start_service_ctx()`
  since it more explicitly defines the functionality of entering
  `Portal.open_context()` with a wrapping cs and completion event inside
  a bg task (which syncs the ctx's lifetime with termination of the
  remote actor runtime).
- factor out what was a `.start_service_ctx()` closure to a new
  `_open_and_supervise_service_ctx()` mod-func holding the meat of
  the supervision logic.

`ServiceMngr` API brief,
- use `open_service_mngr()` and `get_service_mngr()` to acquire the
  actor-global singleton.
- `ServiceMngr.start_service()` and `.cancel_service()` which allow for
  straight forward mgmt of "service subactor daemons".
8ae7aeccca Better separate service tasks vs. ctxs via methods
Namely splitting the handles for each in 2 separate tables and adding
a `.cancel_service_task()`.

Also,
- move `_open_and_supervise_service_ctx()` to mod level.
- rename `target` -> `ctx_fn` params througout.
- fill out method doc strings.
goodboy force-pushed hilevel_serman from 74945f5163 to 1e0399cd44 2025-03-23 04:53:03 +00:00 Compare
goodboy force-pushed hilevel_serman from 1e0399cd44 to 785eba9a22 2025-03-25 20:04:55 +00:00 Compare
This pull request can be merged automatically.
You are not authorized to merge this pull request.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b hilevel_serman ext_type_plds
git pull origin hilevel_serman

Step 2:

Merge the changes and update on Gitea.
git checkout ext_type_plds
git merge --no-ff hilevel_serman
git push origin ext_type_plds
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: goodboy/tractor#12
There is no content yet.