Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-604

Add create_task functionality to frameworks

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:

      Description

      In Motor 2.2 we support Tornado>=5 on Python>=3.5.2. Consequently, it is guaranteed that we will be using the asyncio event loop (Tornado's IOLoop wraps asyncio's event loop on Python 3.5+).
      In Python 3.5.1, the create_task function was added to asyncio's event loop which allows the scheduling of a coroutine and returns a Task object which has the same API as a Future. Using create_task we can schedule the execution of awaitable entities and get rid of manually needing to manage futures. This greatly simplifies the code by making it more modern, concise and easy to reason about.
      In order to use create_task we will need to add it to the framework API of Motor. We will also need to consider the effects of this change on forks/wrappers of Motor that might have implemented their own framework integrations.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            prashant.mital Prashant Mital (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: