Skip to content

Commit

Permalink
Fix python path error using path searching for both python3 and `py…
Browse files Browse the repository at this point in the history
…thon`

Fix #394
  • Loading branch information
haixuanTao committed Dec 20, 2023
1 parent a7244f0 commit adcfeaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions binaries/daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ bincode = "1.3.3"
async-trait = "0.1.64"
arrow-schema = { workspace = true }
aligned-vec = "0.5.0"
which = "4.3.0"
7 changes: 6 additions & 1 deletion binaries/daemon/src/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ pub async fn spawn_node(

let mut command = if has_python_operator && !has_other_operator {
// Use python to spawn runtime if there is a python operator
let mut command = tokio::process::Command::new("python3");
let python = match which::which("python3") {
Ok(python) => python,
Err(_) => which::which("python")
.context("failed to find `python` or `python3` in dora-daemon path. Make sure that python is available for the daemon.")?,
};
let mut command = tokio::process::Command::new(python);
command.args([
"-c",
format!("import dora; dora.start_runtime() # {}", node.id).as_str(),
Expand Down

0 comments on commit adcfeaf

Please sign in to comment.