-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feature: improve async / executor functionality #2070
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
feature: improve async / executor functionality #2070
Conversation
|
I know this one is a big review - everything's interrelated enough that I had a hard time splitting it up, but I could try to refactor into smaller pulls if necessary. |
ecfdfcd to
d5bdcc3
Compare
|
@ahgraber Thanks for the PR. Could you please try rebase and check for the conflicts? |
c68f37c to
4b7774f
Compare
This helps separate async features from executor and engine modules, and will prevent circular imports in these modules.
Introduces a new ProgressBarManager class to manage progress bars for both batch and non-batch execution. This includes methods for creating single and nested progress bars, as well as updating batch progress bars, improving user experience during long-running tasks.
- Refactored `run` function from repeated async, executor, and engine logic. - Changed `as_completed` from async to a regular function for better compatibility. - Added `process_futures` to handle futures with optional progress tracking.
- Refactored Executor to utilize new async_utils and ProgressBarManager for improved composition - Refactored run_async_tasks to utilize ProgressBarManager for improved progress tracking. - Modified tests to validate the new behavior functions
- Introduced a locking mechanism to ensure thread-safe job processing. - Added `_jobs_processed` attribute to maintain consistent job indexing across multiple runs. - Implemented `clear_jobs` method to reset job indices. - Updated tests to verify exception handling and job indexing after clearing jobs. - Adjusted Jupyter notebook tests for consistency in results retrieval.
…sted Transformation or Parallel procedures - The apply_transforms() function has been updated to handle different types of transformations recursively: If transforms is a list, it recursively applies each transform in the list. If transforms is a Parallel instance, it recursively applies the transformations contained within the Parallel object. If transforms is a BaseGraphTransformation, it generates an execution plan (a list of coroutines), gets a description, and then runs the coroutines asynchronously using run_async_tasks(). If transforms is none of the above, it raises a ValueError indicating an invalid type. - Move apply_nest_asyncio to async_utils for better organization - Updated the Parallel class to support transformations with improved type hints. - Added unit tests
…e Executor - nest_asyncio has internal checks for whether it is applied, rely on those - Ensured apply_nest_asyncio is called in the Executor class to handle nested event loops.
- Removed optional progress bar parameter from process_futures. - Updated calls to process_futures to handle progress bar updates directly. - Cleaned up error handling logic for results in async processing.
- Replaced event loop checks with a unified async wrapper for scoring. - Simplified error handling and callback management. - Ensured compatibility with Jupyter environments by applying nest_asyncio directly.
4b7774f to
ad79704
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works with rebase.
This helps separate async features from executor and engine modules, and will prevent circular imports in these modules.
Introduces a new ProgressBarManager class to manage progress bars for both batch and non-batch execution. This includes methods for creating single and nested progress bars, as well as updating batch progress bars, improving user experience during long-running tasks.
runfunction from repeated async, executor, and engine logic.as_completedfrom async to a regular function for better compatibility.process_futuresto handle futures with optional progress tracking._jobs_processedattribute to maintain consistent job indexing across multiple runs.clear_jobsmethod to reset job indices.If transforms is a list, it recursively applies each transform in the list.
If transforms is a Parallel instance, it recursively applies the transformations contained within the Parallel object.
If transforms is a BaseGraphTransformation, it generates an execution plan (a list of coroutines), gets a description, and then runs the coroutines asynchronously using run_async_tasks().
If transforms is none of the above, it raises a ValueError indicating an invalid type.