-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aron Carroll
committed
Dec 12, 2024
1 parent
f2724cd
commit 9ae118a
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Predictor: | ||
async def download(self) -> None: | ||
print("download complete!") | ||
|
||
async def setup(self) -> None: | ||
print("setup starting...") | ||
await self.download() | ||
print("setup complete!") | ||
|
||
async def predict(self) -> str: | ||
print("running prediction") | ||
return "output" |
9 changes: 9 additions & 0 deletions
9
python/tests/server/fixtures/setup_async_with_sync_predict.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Predictor: | ||
async def download(self) -> None: | ||
print("setup used asyncio.run! it's not very effective...") | ||
|
||
async def setup(self) -> None: | ||
await self.download() | ||
|
||
def predict(self) -> str: | ||
return "output" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters