-
Notifications
You must be signed in to change notification settings - Fork 249
Open
Description
Using ContextTask class currently creates empty context for each of the tasks. The desirable behavior would be that child tasks would have access to the parent task context.
Right now it seems its hard to implement the way that would solve it only by modifying the ContextTask code, however it can be solved by running task creation in the parent's context:
# Create a new task. Putting it on the ready queue
def new_task(coro):
# Children should be created with parent context if any
nonlocal current
if current and current._context:
task = current._context.run(taskcls, coro)
else:
task = taskcls(coro)
tasks[task.id] = task
reschedule_task(task)
for a in _activations:
a.created(task)
return task
Metadata
Metadata
Assignees
Labels
No labels