Skip to content

Update async samples to use asyncio.run instead of loop #21207

Closed

Description

  • since Python 3.10 asyncio.get_event_loop is deprecated, a deprecation warning will be emitted if there is no running event loop. (For more context on the deprecation, please check doc: https://docs.python.org/3/library/asyncio-eventloop.html#event-loop)
  • In our repo, asyncio.get_event_loop is used broadly in async samples for execution which means our users will get warning when they execute async samples. example in EH:
    image
  • we should try our best to update our async samples to use asyncio.run instead of loop as suggested by the Python community:

Application developers should typically use the high-level asyncio functions, such as asyncio.run(), and should rarely need to reference the loop object or call its methods. This section is intended mostly for authors of lower-level code, libraries, and frameworks, who need finer control over the event loop behavior.

cc: @lmazuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.EpicMQThis issue is part of a "milestone of quality" initiative.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions