Skip to content

Commit

Permalink
fix: move log of python to cortex logs folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoangthuan99 committed Dec 19, 2024
1 parent 7f9ded0 commit 27d5097
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions engine/extensions/python-engine/python_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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<std::string> args{"--port", model_config.port,
"--log_path", model_config.log_path,
"--log_level", model_config.log_level};
std::list<std::string> 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()) {
Expand Down
1 change: 1 addition & 0 deletions engine/extensions/python-engine/python_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <process.h>
#include <windows.h>
Expand Down

0 comments on commit 27d5097

Please sign in to comment.