From 27d50974d41605a68d6256d40e3f547a7d2ad9eb Mon Sep 17 00:00:00 2001 From: nguyenhoangthuan99 Date: Thu, 19 Dec 2024 15:10:32 +0700 Subject: [PATCH] fix: move log of python to cortex logs folder --- .../extensions/python-engine/python_engine.cc | 18 ++++++++++++------ .../extensions/python-engine/python_engine.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/engine/extensions/python-engine/python_engine.cc b/engine/extensions/python-engine/python_engine.cc index 5e85ed6b6..12c25a76c 100644 --- a/engine/extensions/python-engine/python_engine.cc +++ b/engine/extensions/python-engine/python_engine.cc @@ -360,14 +360,15 @@ void PythonEngine::LoadModel( } auto model_config = models_[model]; auto model_folder_path = model_config.files[0]; - auto data_folder_path = std::filesystem::path(model_folder_path) / std::filesystem::path("venv"); + auto data_folder_path = + std::filesystem::path(model_folder_path) / std::filesystem::path("venv"); try { #ifdef _WIN32 auto executable = std::filesystem::path(data_folder_path) / std::filesystem::path("Scripts"); #else - auto executable = std::filesystem::path(data_folder_path) / - std::filesystem::path("bin"); + auto executable = + std::filesystem::path(data_folder_path) / std::filesystem::path("bin"); #endif auto executable_str = @@ -377,9 +378,14 @@ void PythonEngine::LoadModel( command.push_back((std::filesystem::path(model_folder_path) / std::filesystem::path(model_config.script)) .string()); - std::list args{"--port", model_config.port, - "--log_path", model_config.log_path, - "--log_level", model_config.log_level}; + std::list args{"--port", + model_config.port, + "--log_path", + (file_manager_utils::GetCortexLogPath() / + std::filesystem::path(model_config.log_path)) + .string(), + "--log_level", + model_config.log_level}; if (!model_config.extra_params.isNull() && model_config.extra_params.isObject()) { for (const auto& key : model_config.extra_params.getMemberNames()) { diff --git a/engine/extensions/python-engine/python_engine.h b/engine/extensions/python-engine/python_engine.h index e404f2e19..f862d0ed0 100644 --- a/engine/extensions/python-engine/python_engine.h +++ b/engine/extensions/python-engine/python_engine.h @@ -11,6 +11,7 @@ #include "cortex-common/EngineI.h" #include "extensions/template_renderer.h" #include "utils/file_logger.h" +#include "utils/file_manager_utils.h" #ifdef _WIN32 #include #include