Skip to content

Commit aa21a03

Browse files
authored
chore: add warn log when fix_venv failed (ai-dynamo#338)
1 parent 9242cfa commit aa21a03

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/llm/src/engines/python.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ pub async fn make_string_engine(
7777
) -> pipeline_error::Result<OpenAIChatCompletionsStreamingEngine> {
7878
pyo3::prepare_freethreaded_python();
7979
if let Ok(venv) = env::var("VIRTUAL_ENV") {
80-
Python::with_gil(|py| super::fix_venv(venv, py));
80+
Python::with_gil(|py| {
81+
if let Err(e) = super::fix_venv(venv, py) {
82+
tracing::warn!("failed to fix venv: {}", e);
83+
}
84+
});
8185
}
8286

8387
let engine = new_engine(cancel_token, py_file, py_args).await?;
@@ -93,7 +97,11 @@ pub async fn make_token_engine(
9397
) -> pipeline_error::Result<ExecutionContext> {
9498
pyo3::prepare_freethreaded_python();
9599
if let Ok(venv) = env::var("VIRTUAL_ENV") {
96-
Python::with_gil(|py| super::fix_venv(venv, py));
100+
Python::with_gil(|py| {
101+
if let Err(e) = super::fix_venv(venv, py) {
102+
tracing::warn!("failed to fix venv: {}", e);
103+
}
104+
});
97105
}
98106

99107
let engine = new_engine(cancel_token, py_file, py_args).await?;

0 commit comments

Comments
 (0)