-
Notifications
You must be signed in to change notification settings - Fork 906
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
[Internal][Executor] Refine the LineExecutionProcessPool to align more closely with a standard process pool #2234
Conversation
…evs/peiwen/refactor_line_process_pool
SDK CLI Global Config Test Result devs/peiwen/refactor_line_process_pool2 tests 2 ✅ 45s ⏱️ Results for commit 22dd51e. ♻️ This comment has been updated with latest results. |
Executor Unit Test Result devs/peiwen/refactor_line_process_pool754 tests 754 ✅ 3m 56s ⏱️ Results for commit 22dd51e. ♻️ This comment has been updated with latest results. |
promptflow SDK CLI Azure E2E Test Result devs/peiwen/refactor_line_process_pool 4 files 4 suites 3m 47s ⏱️ Results for commit 22dd51e. ♻️ This comment has been updated with latest results. |
Executor E2E Test Result devs/peiwen/refactor_line_process_pool210 tests 208 ✅ 8m 11s ⏱️ Results for commit 22dd51e. ♻️ This comment has been updated with latest results. |
SDK CLI Test Result devs/peiwen/refactor_line_process_pool 12 files 12 suites 40m 29s ⏱️ Results for commit 22dd51e. ♻️ This comment has been updated with latest results. |
promptflow-tracing e2e test result devs/peiwen/refactor_line_process_pool 4 files 4 suites 1m 36s ⏱️ Results for commit 22dd51e. ♻️ This comment has been updated with latest results. |
…evs/peiwen/refactor_line_process_pool
Description
Background
After splitting the executor and runtime into two separate containers, the implementation of batch run in the executor server also requires a process pool to handle execution requests line by line. Therefore, we need the line process pool to have the capability to process individual lines. As a process pool, it should also have the ability to submit one or multiple tasks at a time, consistent with the python process pool interface.
Usages
Public Functions
start
: Create task queue, input/output queues, and start processes and monitor thread pool.close
: Send terminate signal to monitor threads, end processes and close thread pool.run
: Put all line inputs to task queue and get the line results list.submit
: Put one line input to task queue and get one line result.Implementation Process
Main Differences from Previous Implementation
run
method.run
to async function.Code Changes Sunmary
This pull request includes changes to various parts of the
promptflow
system, with the main focus being the addition of new functionalities and the refactoring of existing code for better performance and readability. The most significant changes include the addition of a new function to convert multimedia data to string, the introduction of a method to determine the maximum number of workers that can be created, the conversion of some functions to asynchronous, and the implementation of new exception classes.New functionalities:
src/promptflow/promptflow/_utils/multimedia_utils.py
: Added a new functionconvert_multimedia_data_to_string
to convert multimedia data to string.src/promptflow/promptflow/_utils/process_utils.py
: Introduced a new functionget_available_max_worker_count
to determine the maximum number of workers that can be created.src/promptflow/promptflow/executor/_errors.py
: Implemented new exception classesThreadCrashError
andProcessCrashError
to handle thread and process crashes.Refactoring:
src/promptflow/promptflow/batch/_batch_engine.py
,src/promptflow/promptflow/batch/_python_executor_proxy.py
: Converted some functions to asynchronous for better performance. [1] [2] [3]src/promptflow/promptflow/executor/_process_manager.py
: Refactored theAbstractProcessManager
andSpawnProcessManager
classes, added new methods for process management, and made changes to improve readability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]src/promptflow/tests/executor/e2etests/test_batch_timeout.py
,src/promptflow/tests/executor/unittests/_utils/test_process_utils.py
,src/promptflow/tests/executor/unittests/executor/test_line_execution_process_pool.py
: Updated test cases to reflect the changes made in the codebase. [1] [2] [3] [4]Additions:
src/promptflow/promptflow/storage/_queue_run_storage.py
: Added a new storage classQueueRunStorage
for storing run information in a queue.All Promptflow Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines