Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Add a task_factory to support custom Task subclasses #185

Closed
GoogleCodeExporter opened this issue Apr 10, 2015 · 2 comments
Closed

Add a task_factory to support custom Task subclasses #185

GoogleCodeExporter opened this issue Apr 10, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

To support Trollius, the greenio project requires a "task factory" to create 
GreenTask instead of Task in Task._step(). In february, Luca Sbardella sent a 
similar request for its Pulsar project.

I propose to add get_task_factory() and set_task_factory() to event loop 
policy. The default task factory would be the Task class in asyncio, but the 
default may be different in a custom event loop policy.

Patch:
https://codereview.appspot.com/110820049/

See also the "Tulip, Trollius and greenio: add asyncio.tasks.task_factory" 
thread on the mailing list.

Original issue reported on code.google.com by victor.s...@gmail.com on 5 Jul 2014 at 1:50

@GoogleCodeExporter
Copy link
Author

I commited the new patch into Tulip (56639cc52d95), Python 3.4 (8d759d8f6ccb) 
and Python 3.5 (c7960cc9daa5).

I also updated the documentation to "hide" the Task constructor and use 
create_task() instead:

- Document the new create_task() method
- "Hide" the Task class: point to the create_task() method for interoperability
- Rewrite the documentation of the Task class
- Document the "Pending task destroyed"
- Update output in debug mode of examples in the dev section
- Replace Task() with create_task() in examples

Original comment by victor.s...@gmail.com on 8 Jul 2014 at 10:46

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

I merged Tulip into Trollius, so Trollius also has its create_task() method.

I also updated my greenio pull request to support Trollius:
https://github.com/1st1/greenio/pull/5/

This pull request was my initial use case to create_task().

Original comment by victor.s...@gmail.com on 8 Jul 2014 at 11:16

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant