Browse Source

Run python exemple inside of python env

tags/v0.0.0-test.4
haixuanTao 3 years ago
parent
commit
ff814e0a2a
2 changed files with 9 additions and 19 deletions
  1. +6
    -18
      examples/python-dataflow/run.rs
  2. +3
    -1
      examples/python-dataflow/run.sh

+ 6
- 18
examples/python-dataflow/run.rs View File

@@ -9,19 +9,7 @@ async fn main() -> eyre::Result<()> {

build_package("dora-runtime").await?;

install_python_dependencies(root).await?;

let dataflow = if env::var("CI").is_ok() {
Path::new("dataflow_without_webcam.yml").to_owned()
} else {
Path::new("dataflow.yml").to_owned()
};

dora_coordinator::run(dora_coordinator::Command::Run {
dataflow,
runtime: Some(root.join("target").join("release").join("dora-runtime")),
})
.await?;
run(root).await?;

Ok(())
}
@@ -37,11 +25,11 @@ async fn build_package(package: &str) -> eyre::Result<()> {
Ok(())
}

async fn install_python_dependencies(_root: &Path) -> eyre::Result<()> {
let mut install = tokio::process::Command::new("sh");
install.arg("./install.sh");
if !install.status().await?.success() {
bail!("failed to create venv");
async fn run(_root: &Path) -> eyre::Result<()> {
let mut run = tokio::process::Command::new("sh");
run.arg("./run.sh");
if !run.status().await?.success() {
bail!("failed to run python example.");
};
Ok(())
}

examples/python-dataflow/install.sh → examples/python-dataflow/run.sh View File

@@ -7,4 +7,6 @@ maturin develop
cd ../../../examples/python-dataflow

# Dependencies
pip install -r requirements.txt
pip install -r requirements.txt

cargo run -p dora-coordinator --release -- run dataflow_without_webcam.yml

Loading…
Cancel
Save