-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support async setup method on Predictor
This commit introduces the ability to define an async `setup` function on your predictor. For simplicity an async `setup()` function is only supported alongside an async `predict()` function. An error will be raised during setup if this is not the case. Various pieces of the code have been extracted into smaller methods in order to achieve this. A new `_handle_setup_error` context manager has been created to handle setup errors and send appropriate `Done` event over the worker channel. The `_setup()` method has been split into two phases, first we perform validation on the requirements for async/concurrency support. Then we attempt to run the `setup()` method either as a direct call for the non-async path or as part of the event loop in the async path.
- Loading branch information
Aron Carroll
committed
Dec 12, 2024
1 parent
08e00ec
commit 541dfae
Showing
1 changed file
with
102 additions
and
41 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