You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Nursery.start() is implemented internally by opening a private nursery and starting the new task there, and TaskStatus.started() moves all tasks from that private nursery (the "old_nursery") to the task's final home ("new_nursery", the nursery whose start() method was called). In theory, there should only be one task in the old nursery, since the nursery isn't exposed anywhere outside the body of start() for anyone to be able to start more. In practice, it's possible to access the old nursery via current_task().parent_nursery in the newly-started task, so we may have some users who are starting more tasks there, maybe not even realizing that it's not the same nursery on which start() was called. This currently works fine, but it's confusing and makes it hard to implement extensions to the nursery semantics such as #1521.
Since this works now, we probably want a deprecation period. The purpose of this issue is mostly to have a number to put in the deprecation message. If your code runs into this, ideally you would refactor it to pass a nursery around explicitly rather than assuming you can always start new tasks in your parent nursery. If that's not possible for some reason, you can use task.eventual_parent_nursery or task.parent_nursery to determine the parent nursery that will prevail once the start() call completes.
The text was updated successfully, but these errors were encountered:
Currently,
Nursery.start()
is implemented internally by opening a private nursery and starting the new task there, andTaskStatus.started()
moves all tasks from that private nursery (the "old_nursery") to the task's final home ("new_nursery", the nursery whosestart()
method was called). In theory, there should only be one task in the old nursery, since the nursery isn't exposed anywhere outside the body ofstart()
for anyone to be able to start more. In practice, it's possible to access the old nursery viacurrent_task().parent_nursery
in the newly-started task, so we may have some users who are starting more tasks there, maybe not even realizing that it's not the same nursery on which start() was called. This currently works fine, but it's confusing and makes it hard to implement extensions to the nursery semantics such as #1521.Since this works now, we probably want a deprecation period. The purpose of this issue is mostly to have a number to put in the deprecation message. If your code runs into this, ideally you would refactor it to pass a nursery around explicitly rather than assuming you can always start new tasks in your parent nursery. If that's not possible for some reason, you can use
task.eventual_parent_nursery or task.parent_nursery
to determine the parent nursery that will prevail once thestart()
call completes.The text was updated successfully, but these errors were encountered: