From cd2291e0024cf7e08b2e1b4150d7280b74618766 Mon Sep 17 00:00:00 2001 From: Hhhilulu <115983968+Hhhilulu@users.noreply.github.com> Date: Fri, 8 Sep 2023 18:08:40 +0800 Subject: [PATCH] [PromptFlow] Move import to the head of the file to avoid package references. (#349) # Description Move import to the head of the file to avoid package references. # All Promptflow Contribution checklist: - [x] **The pull request does not introduce [breaking changes]** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --- .../promptflow/executor/_line_execution_process_pool.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/promptflow/promptflow/executor/_line_execution_process_pool.py b/src/promptflow/promptflow/executor/_line_execution_process_pool.py index 12fbe105829..d53a1d975ab 100644 --- a/src/promptflow/promptflow/executor/_line_execution_process_pool.py +++ b/src/promptflow/promptflow/executor/_line_execution_process_pool.py @@ -1,6 +1,9 @@ import contextvars import multiprocessing import queue +import math +import os +import psutil from datetime import datetime from functools import partial from logging import INFO @@ -363,11 +366,6 @@ def create_executor_legacy(*, flow, connections, loaded_tools, cache_manager, st def get_available_max_worker_count(): - import math - import os - - import psutil - pid = os.getpid() mem_info = psutil.virtual_memory() total_memory = mem_info.total / (1024 * 1024) # in MB