Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Add initial support for asyncio #471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VivekPanyam
Copy link
Collaborator

Summary:

Add initial support for running infer using asyncio.

This implementation currently blocks the event loop so it shouldn't be used just yet

Test Plan:

Added a test + CI

@codecov
Copy link

codecov bot commented Jan 14, 2021

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.28%. Comparing base (c15727e) to head (03deced).
Report is 56 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #471      +/-   ##
==========================================
+ Coverage   88.23%   88.28%   +0.04%     
==========================================
  Files         106      106              
  Lines        6852     6878      +26     
==========================================
+ Hits         6046     6072      +26     
  Misses        806      806              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


with load_neuropod(path) as model:
# Async infer
result = loop.run_until_complete(model.infer_async(input_data))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close loop? Or use "run" that cares about it (I see it has "debug" that maybe good for test) https://docs.python.org/3/library/asyncio-task.html#running-an-asyncio-program

Copy link
Contributor

@vkuzmin-uber vkuzmin-uber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left comment, I guess there is a resource leak w/o explicit close of loop

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

Successfully merging this pull request may close these issues.

2 participants