-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial prototype for trio.Nursery
per-task-scope-mangement via a user defined single-yield-generator function 😎
#363
Draft
goodboy
wants to merge
8
commits into
ctx_cancel_semantics_and_overruns
Choose a base branch
from
oco_supervisor_prototype
base: ctx_cancel_semantics_and_overruns
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Commits on May 19, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 5fc8fa5 - Browse repository at this point
Copy the full SHA 5fc8fa5View commit details -
Configuration menu - View commit details
-
Copy full SHA for b485871 - Browse repository at this point
Copy the full SHA b485871View commit details -
Do renaming, implement lowlevel
Outcome
sendingAs was listed in the many todos, this changes the `.start_soon()` impl to instead (manually) `.send()` into the user defined `@task_scope_manager` an `Outcome` from the spawned task. In this case the task manager wraps that in a user defined (and renamed) `TaskOutcome` and delivers that + a containing `trio.CancelScope` to the `.start_soon()` caller. Here the user defined `TaskOutcome` defines a `.wait_for_result()` method that can be used to await the task's exit and handle it's underlying returned value or raised error; the implementation could be different and subject to the user's own whims. Note that by default, if this was added to `trio`'s core, the `@task_scope_manager` would simply be implemented as either a `None` yielding single-yield-generator but more likely just entirely ignored by the runtime (as in no manual task outcome collecting, generator calling and sending is done at all) by default if the user does not provide the `task_scope_manager` to the nursery at open time.
Configuration menu - View commit details
-
Copy full SHA for 65c5d7d - Browse repository at this point
Copy the full SHA 65c5d7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for f23b5b8 - Browse repository at this point
Copy the full SHA f23b5b8View commit details -
Ensure user-allocated cancel scope just works!
Turns out the nursery doesn't have to care about allocating a per task `CancelScope` since the user can just do that in the `@task_scope_manager` if desired B) So just mask all the nursery cs allocating with the intention of removal. Also add a test for per-task-cancellation by starting the crash task as a `trio.sleep_forever()` but then cancel it via the user allocated cs and ensure the crash propagates as expected 💥
Configuration menu - View commit details
-
Copy full SHA for 56882b6 - Browse repository at this point
Copy the full SHA 56882b6View commit details -
More refinements and proper typing
- drop unneeded (and commented) internal cs allocating bits. - bypass all task manager stuff if no generator is provided by the caller; i.e. just call `.start_soon()` as normal. - fix `Generator` typing. - add some prints around task manager. - wrap in `TaskOutcome.lowlevel_task: Task`.
Configuration menu - View commit details
-
Copy full SHA for 940e65f - Browse repository at this point
Copy the full SHA 940e65fView commit details -
Configuration menu - View commit details
-
Copy full SHA for e0c888f - Browse repository at this point
Copy the full SHA e0c888fView commit details -
Add
debug_mode: bool
control to task mngrAllows dynamically importing `pdbp` when enabled and a way for eventually linking with `tractor`'s own debug mode flag.
Configuration menu - View commit details
-
Copy full SHA for c7e27ad - Browse repository at this point
Copy the full SHA c7e27adView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.