Browse Source

Merge pull request #398 from dora-rs/fix-window-path-error

Fix window path error
tags/v0.3.1-rc5
Haixuan Xavier Tao GitHub 2 years ago
parent
commit
e35ed75e87
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 558 additions and 426 deletions
  1. +11
    -10
      .github/workflows/ci.yml
  2. +1
    -0
      .gitignore
  3. +245
    -102
      Cargo.lock
  4. +2
    -0
      Cargo.toml
  5. +3
    -3
      apis/python/node/README.md
  6. +1
    -2
      binaries/cli/src/template/python/dataflow-template.yml
  7. +1
    -1
      binaries/coordinator/Cargo.toml
  8. +1
    -0
      binaries/daemon/Cargo.toml
  9. +10
    -1
      binaries/daemon/src/pending.rs
  10. +20
    -4
      binaries/daemon/src/spawn.rs
  11. +2
    -14
      examples/benchmark/run.rs
  12. +2
    -14
      examples/c++-dataflow/run.rs
  13. +2
    -14
      examples/c-dataflow/run.rs
  14. +2
    -14
      examples/cmake-dataflow/run.rs
  15. +2
    -14
      examples/multiple-daemons/run.rs
  16. +12
    -7
      examples/python-dataflow/object_detection.py
  17. +0
    -1
      examples/python-dataflow/plot.py
  18. +2
    -4
      examples/python-dataflow/requirements.txt
  19. +58
    -50
      examples/python-dataflow/run.rs
  20. +0
    -7
      examples/python-operator-dataflow/dataflow.yml
  21. +10
    -5
      examples/python-operator-dataflow/object_detection.py
  22. +6
    -9
      examples/python-operator-dataflow/requirements.txt
  23. +58
    -50
      examples/python-operator-dataflow/run.rs
  24. +52
    -53
      examples/python-ros2-dataflow/run.rs
  25. +2
    -14
      examples/rust-dataflow-url/run.rs
  26. +2
    -14
      examples/rust-dataflow/run.rs
  27. +2
    -14
      examples/rust-ros2-dataflow/run.rs
  28. +2
    -2
      libraries/core/Cargo.toml
  29. +2
    -1
      libraries/core/src/descriptor/validate.rs
  30. +44
    -1
      libraries/core/src/lib.rs
  31. +1
    -1
      libraries/extensions/download/Cargo.toml

+ 11
- 10
.github/workflows/ci.yml View File

@@ -8,7 +8,7 @@ on:
workflow_dispatch:

env:
RUST_LOG: trace
RUST_LOG: INFO

jobs:
test:
@@ -65,13 +65,7 @@ jobs:
- name: "Build (Without Python node as it is build with maturin)"
run: cargo build --all --exclude dora-node-api-python
- name: "Test"
# Remove Windows as there is `pdb` linker issue.
# See: https://github.com/dora-rs/dora/pull/359#discussion_r1360268497
if: runner.os == 'Linux' || runner.os == 'macOS'
run: cargo test --all
- name: "Test"
if: runner.os == 'Windows'
run: cargo test --all --lib

# Run examples as separate job because otherwise we will exhaust the disk
# space of the GitHub action runners.
@@ -138,14 +132,16 @@ jobs:

# python examples
- uses: actions/setup-python@v2
if: runner.os == 'Linux' || runner.os == 'macOS'
if: runner.os != 'Windows'
with:
python-version: "3.8"
- uses: actions/setup-python@v2
if: runner.os == 'Windows'
with:
python-version: "3.10"
- name: "Python Dataflow example"
if: runner.os == 'Linux' || runner.os == 'macOS'
run: cargo run --example python-dataflow
- name: "Python Operator Dataflow example"
if: runner.os == 'Linux' || runner.os == 'macOS'
run: cargo run --example python-operator-dataflow

# ROS2 bridge examples
@@ -176,8 +172,13 @@ jobs:
source /opt/ros/humble/setup.bash && ros2 run turtlesim turtlesim_node &
cargo run --example rust-ros2-dataflow --features="ros2-examples"
- uses: actions/setup-python@v2
if: runner.os != 'Windows'
with:
python-version: "3.8"
- uses: actions/setup-python@v2
if: runner.os == 'Windows'
with:
python-version: "3.10"
- name: "python-ros2-dataflow"
timeout-minutes: 30
env:


+ 1
- 0
.gitignore View File

@@ -7,6 +7,7 @@

# Remove arrow file from dora-record
**/*.arrow
*.pt

# Removing images.
*.jpg


+ 245
- 102
Cargo.lock View File

@@ -30,15 +30,16 @@ dependencies = [

[[package]]
name = "ahash"
version = "0.8.3"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
dependencies = [
"cfg-if 1.0.0",
"const-random",
"getrandom",
"once_cell",
"version_check",
"zerocopy",
]

[[package]]
@@ -193,7 +194,7 @@ dependencies = [
"arrow-schema",
"chrono",
"half",
"hashbrown 0.14.1",
"hashbrown 0.14.3",
"num",
]

@@ -317,7 +318,7 @@ dependencies = [
"arrow-data",
"arrow-schema",
"half",
"hashbrown 0.14.1",
"hashbrown 0.14.3",
]

[[package]]
@@ -524,7 +525,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -954,7 +955,7 @@ dependencies = [
"heck 0.4.1",
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -1052,23 +1053,21 @@ checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f"

[[package]]
name = "const-random"
version = "0.1.15"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368a7a772ead6ce7e1de82bfb04c485f3db8ec744f72925af5735e29a22cc18e"
checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a"
dependencies = [
"const-random-macro",
"proc-macro-hack",
]

[[package]]
name = "const-random-macro"
version = "0.1.15"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d7d6ab3c3a2282db210df5f02c4dab6e0a7057af0fb7ebd4070f30fe05c0ddb"
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
dependencies = [
"getrandom",
"once_cell",
"proc-macro-hack",
"tiny-keccak",
]

@@ -1254,9 +1253,9 @@ dependencies = [

[[package]]
name = "cxx-build"
version = "1.0.107"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4ce20f6b8433da4841b1dadfb9468709868022d829d5ca1f2ffbda928455ea3"
checksum = "51bc81d2664db24cf1d35405f66e18a85cffd4d49ab930c71a5c6342a410f38c"
dependencies = [
"cc",
"codespan-reporting",
@@ -1264,7 +1263,7 @@ dependencies = [
"proc-macro2",
"quote",
"scratch",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -1281,7 +1280,7 @@ checksum = "2fa16a70dd58129e4dfffdff535fb1bce66673f7bbeec4a5a1765a504e1ccd84"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -1326,7 +1325,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [
"cfg-if 1.0.0",
"hashbrown 0.14.1",
"hashbrown 0.14.3",
"lock_api",
"once_cell",
"parking_lot_core",
@@ -1504,6 +1503,7 @@ dependencies = [
"tracing",
"tracing-opentelemetry",
"uuid",
"which",
]

[[package]]
@@ -1524,6 +1524,8 @@ dependencies = [
"dora-coordinator",
"dora-core",
"dora-daemon",
"dora-download",
"dora-tracing",
"dunce",
"eyre",
"futures",
@@ -1914,7 +1916,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -1938,23 +1940,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"

[[package]]
name = "errno"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.48.0",
]

[[package]]
name = "errno-dragonfly"
version = "0.1.2"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"cc",
"libc",
"windows-sys 0.52.0",
]

[[package]]
@@ -2097,9 +2088,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"

[[package]]
name = "form_urlencoded"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
@@ -2219,7 +2210,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -2289,7 +2280,7 @@ checksum = "ba330b70a5341d3bc730b8e205aaee97ddab5d9c448c4f51a7c2d924266fa8f9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -2341,15 +2332,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"

[[package]]
name = "globset"
version = "0.4.13"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
dependencies = [
"aho-corasick",
"bstr",
"fnv",
"log",
"regex",
"regex-automata 0.4.3",
"regex-syntax 0.8.2",
]

[[package]]
@@ -2418,9 +2409,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"

[[package]]
name = "hashbrown"
version = "0.14.1"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"

[[package]]
name = "heck"
@@ -2540,6 +2531,20 @@ dependencies = [
"want",
]

[[package]]
name = "hyper-rustls"
version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
dependencies = [
"futures-util",
"http",
"hyper",
"rustls 0.21.10",
"tokio",
"tokio-rustls",
]

[[package]]
name = "hyper-timeout"
version = "0.4.1"
@@ -2583,9 +2588,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"

[[package]]
name = "idna"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@@ -2624,7 +2629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
dependencies = [
"equivalent",
"hashbrown 0.14.1",
"hashbrown 0.14.3",
]

[[package]]
@@ -2779,7 +2784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi 0.3.3",
"rustix 0.38.20",
"rustix 0.38.28",
"windows-sys 0.48.0",
]

@@ -2987,9 +2992,9 @@ dependencies = [

[[package]]
name = "libc"
version = "0.2.148"
version = "0.2.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"

[[package]]
name = "libgit2-sys"
@@ -3063,9 +3068,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"

[[package]]
name = "linux-raw-sys"
version = "0.4.8"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"

[[package]]
name = "local-ip-address"
@@ -3913,9 +3918,9 @@ dependencies = [

[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"

[[package]]
name = "pest"
@@ -3948,7 +3953,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -3989,7 +3994,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -4210,9 +4215,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"

[[package]]
name = "proc-macro2"
version = "1.0.68"
version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c"
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
dependencies = [
"unicode-ident",
]
@@ -4288,7 +4293,7 @@ dependencies = [
"proc-macro2",
"pyo3-macros-backend",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -4300,7 +4305,7 @@ dependencies = [
"heck 0.4.1",
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -4348,7 +4353,7 @@ checksum = "c956be1b23f4261676aed05a0046e204e8a6836e50203902683a718af0797989"
dependencies = [
"bytes",
"rand",
"ring",
"ring 0.16.20",
"rustc-hash",
"rustls 0.20.9",
"rustls-native-certs",
@@ -4374,9 +4379,9 @@ dependencies = [

[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@@ -4517,6 +4522,17 @@ dependencies = [
"regex-syntax 0.7.5",
]

[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax 0.8.2",
]

[[package]]
name = "regex-syntax"
version = "0.6.29"
@@ -4550,6 +4566,7 @@ dependencies = [
"http",
"http-body",
"hyper",
"hyper-rustls",
"ipnet",
"js-sys",
"log",
@@ -4557,17 +4574,20 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
"rustls 0.21.7",
"rustls 0.21.10",
"rustls-pemfile",
"serde",
"serde_json",
"serde_urlencoded",
"system-configuration",
"tokio",
"tokio-rustls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots 0.25.3",
"winreg",
]

@@ -4590,11 +4610,25 @@ dependencies = [
"libc",
"once_cell",
"spin 0.5.2",
"untrusted",
"untrusted 0.7.1",
"web-sys",
"winapi 0.3.9",
]

[[package]]
name = "ring"
version = "0.17.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74"
dependencies = [
"cc",
"getrandom",
"libc",
"spin 0.9.8",
"untrusted 0.9.0",
"windows-sys 0.48.0",
]

[[package]]
name = "ringbuffer-spsc"
version = "0.1.9"
@@ -4761,15 +4795,15 @@ dependencies = [

[[package]]
name = "rustix"
version = "0.38.20"
version = "0.38.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
dependencies = [
"bitflags 2.4.0",
"errno",
"libc",
"linux-raw-sys 0.4.8",
"windows-sys 0.48.0",
"linux-raw-sys 0.4.12",
"windows-sys 0.52.0",
]

[[package]]
@@ -4779,19 +4813,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
dependencies = [
"log",
"ring",
"ring 0.16.20",
"sct",
"webpki",
]

[[package]]
name = "rustls"
version = "0.21.7"
version = "0.21.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8"
checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
dependencies = [
"log",
"ring",
"ring 0.17.7",
"rustls-webpki",
"sct",
]
@@ -4819,12 +4853,12 @@ dependencies = [

[[package]]
name = "rustls-webpki"
version = "0.101.6"
version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [
"ring",
"untrusted",
"ring 0.17.7",
"untrusted 0.9.0",
]

[[package]]
@@ -4912,8 +4946,8 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
dependencies = [
"ring",
"untrusted",
"ring 0.16.20",
"untrusted 0.7.1",
]

[[package]]
@@ -4947,9 +4981,9 @@ checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"

[[package]]
name = "serde"
version = "1.0.188"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
dependencies = [
"serde_derive",
]
@@ -4984,13 +5018,13 @@ dependencies = [

[[package]]
name = "serde_derive"
version = "1.0.188"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -5012,7 +5046,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -5220,7 +5254,7 @@ checksum = "2a004c141c54615778c01a6722f6453fae7013e501b2b1f2dfe5684037174721"
dependencies = [
"io-extras",
"io-lifetimes 2.0.2",
"rustix 0.38.20",
"rustix 0.38.28",
"uuid",
"windows-sys 0.48.0",
]
@@ -5243,7 +5277,7 @@ checksum = "7d395866cb6778625150f77a430cc0af764ce0300f6a3d3413477785fa34b6c7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -5326,9 +5360,9 @@ dependencies = [

[[package]]
name = "syn"
version = "2.0.38"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"proc-macro2",
"quote",
@@ -5435,7 +5469,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
dependencies = [
"rustix 0.38.20",
"rustix 0.38.28",
"windows-sys 0.48.0",
]

@@ -5462,7 +5496,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -5586,7 +5620,17 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
name = "tokio-rustls"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
"rustls 0.21.10",
"tokio",
]

[[package]]
@@ -5693,7 +5737,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -5842,6 +5886,12 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"

[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"

[[package]]
name = "unwind_safe"
version = "0.1.0"
@@ -5861,9 +5911,9 @@ dependencies = [

[[package]]
name = "url"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna",
@@ -5902,7 +5952,7 @@ checksum = "f7e1ba1f333bd65ce3c9f27de592fcbc256dafe3af2717f56d7c87761fbaccf4"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
]

[[package]]
@@ -6011,7 +6061,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
"wasm-bindgen-shared",
]

@@ -6045,7 +6095,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
"syn 2.0.48",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -6089,8 +6139,8 @@ version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f"
dependencies = [
"ring",
"untrusted",
"ring 0.16.20",
"untrusted 0.7.1",
]

[[package]]
@@ -6102,16 +6152,23 @@ dependencies = [
"webpki",
]

[[package]]
name = "webpki-roots"
version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"

[[package]]
name = "which"
version = "4.4.2"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
checksum = "9bf3ea8596f3a0dd5980b46430f2058dfe2c36a27ccfbb1845d6fbfcd9ba6e14"
dependencies = [
"either",
"home",
"once_cell",
"rustix 0.38.20",
"rustix 0.38.28",
"windows-sys 0.48.0",
]

[[package]]
@@ -6236,6 +6293,15 @@ dependencies = [
"windows-targets 0.48.5",
]

[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.0",
]

[[package]]
name = "windows-targets"
version = "0.42.2"
@@ -6266,6 +6332,21 @@ dependencies = [
"windows_x86_64_msvc 0.48.5",
]

[[package]]
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm 0.52.0",
"windows_aarch64_msvc 0.52.0",
"windows_i686_gnu 0.52.0",
"windows_i686_msvc 0.52.0",
"windows_x86_64_gnu 0.52.0",
"windows_x86_64_gnullvm 0.52.0",
"windows_x86_64_msvc 0.52.0",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
@@ -6278,6 +6359,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"

[[package]]
name = "windows_aarch64_msvc"
version = "0.34.0"
@@ -6296,6 +6383,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"

[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"

[[package]]
name = "windows_i686_gnu"
version = "0.34.0"
@@ -6314,6 +6407,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"

[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"

[[package]]
name = "windows_i686_msvc"
version = "0.34.0"
@@ -6332,6 +6431,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"

[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"

[[package]]
name = "windows_x86_64_gnu"
version = "0.34.0"
@@ -6350,6 +6455,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"

[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
@@ -6362,6 +6473,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"

[[package]]
name = "windows_x86_64_msvc"
version = "0.34.0"
@@ -6380,6 +6497,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"

[[package]]
name = "winreg"
version = "0.50.0"
@@ -6667,7 +6790,7 @@ dependencies = [
"log",
"rustls-pemfile",
"webpki",
"webpki-roots",
"webpki-roots 0.22.6",
"zenoh-cfg-properties",
"zenoh-config",
"zenoh-core",
@@ -6839,6 +6962,26 @@ dependencies = [
"zenoh-sync",
]

[[package]]
name = "zerocopy"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
dependencies = [
"zerocopy-derive",
]

[[package]]
name = "zerocopy-derive"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]

[[package]]
name = "zeroize"
version = "1.6.0"


+ 2
- 0
Cargo.toml View File

@@ -84,6 +84,8 @@ tokio = "1.24.2"
dora-daemon = { workspace = true }
dora-coordinator = { workspace = true }
dora-core = { workspace = true }
dora-tracing = { workspace = true }
dora-download = { workspace = true }
dunce = "1.0.2"
serde_yaml = "0.8.23"
uuid = { version = "1.2.1", features = ["v4", "serde"] }


+ 3
- 3
apis/python/node/README.md View File

@@ -4,9 +4,9 @@ This crate corresponds to the Node API for Dora.

To build the Python module for development:

````bash
python3 -m venv .env
```bash
python -m venv .env
source .env/bin/activate
pip install maturin
maturin develop
````
```

+ 1
- 2
binaries/cli/src/template/python/dataflow-template.yml View File

@@ -16,8 +16,7 @@ nodes:

- id: custom-node_1
custom:
source: python3
args: ./node_1/node_1.py
source: ./node_1/node_1.py
inputs:
tick: dora/timer/secs/1
input-1: op_1/some-output


+ 1
- 1
binaries/coordinator/Cargo.toml View File

@@ -27,7 +27,7 @@ dora-tracing = { workspace = true, optional = true }
futures-concurrency = "7.1.0"
zenoh = "0.7.0-rc"
serde_json = "1.0.86"
which = "4.3.0"
which = "5.0.0"
thiserror = "1.0.37"
ctrlc = "3.2.5"
clap = { version = "4.0.3", features = ["derive"] }


+ 1
- 0
binaries/daemon/Cargo.toml View File

@@ -39,3 +39,4 @@ bincode = "1.3.3"
async-trait = "0.1.64"
arrow-schema = { workspace = true }
aligned-vec = "0.5.0"
which = "5.0.0"

+ 10
- 1
binaries/daemon/src/pending.rs View File

@@ -128,11 +128,20 @@ impl PendingNodes {
None => Ok(()),
}
} else {
let node_id_message = if self.exited_before_subscribe.len() == 1 {
self.exited_before_subscribe
.iter()
.next()
.map(|node_id| node_id.to_string())
.unwrap_or("<node_id>".to_string())
} else {
"<node_id>".to_string()
};
Err(format!(
"Some nodes exited before subscribing to dora: {:?}\n\n\
This is typically happens when an initialization error occurs
in the node or operator. To check the output of the failed
nodes, run `dora logs {} <node_id>`.",
nodes, run `dora logs {} {node_id_message}`.",
self.exited_before_subscribe, self.dataflow_id
))
};


+ 20
- 4
binaries/daemon/src/spawn.rs View File

@@ -8,6 +8,7 @@ use dora_core::{
descriptor::{
resolve_path, source_is_url, Descriptor, OperatorSource, ResolvedNode, SHELL_SOURCE,
},
get_python_path,
message::uhlc::HLC,
};
use dora_download::download_file;
@@ -81,8 +82,22 @@ pub async fn spawn_node(
})?
};

tracing::info!("spawning {}", resolved_path.display());
let mut cmd = tokio::process::Command::new(&resolved_path);
// If extension is .py, use python to run the script
let mut cmd = match resolved_path.extension().map(|ext| ext.to_str()) {
Some(Some("py")) => {
let python = get_python_path().context("Could not get python path")?;
tracing::info!("spawning: {:?} {}", &python, resolved_path.display());
let mut cmd = tokio::process::Command::new(&python);
cmd.arg(&resolved_path);
cmd
}
_ => {
tracing::info!("spawning: {}", resolved_path.display());
let cmd = tokio::process::Command::new(&resolved_path);
cmd
}
};

if let Some(args) = &n.args {
cmd.args(args.split_ascii_whitespace());
}
@@ -120,7 +135,7 @@ pub async fn spawn_node(
format!(
"failed to run `{}` with args `{}`",
n.source,
n.args.as_deref().unwrap_or_default()
n.args.as_deref().unwrap_or_default(),
)
})?
}
@@ -137,7 +152,8 @@ 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 = get_python_path().context("Could not find python in daemon")?;
let mut command = tokio::process::Command::new(python);
command.args([
"-c",
format!("import dora; dora.start_runtime() # {}", node.id).as_str(),


+ 2
- 14
examples/benchmark/run.rs View File

@@ -1,7 +1,6 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::path::Path;
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -17,7 +16,7 @@ async fn main() -> eyre::Result<()> {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}

set_up_tracing().wrap_err("failed to set up tracing subscriber")?;
set_up_tracing("benchmark-runner").wrap_err("failed to set up tracing subscriber")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
@@ -42,14 +41,3 @@ async fn build_dataflow(dataflow: &Path) -> eyre::Result<()> {
};
Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/c++-dataflow/run.rs View File

@@ -1,10 +1,9 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::{
env::consts::{DLL_PREFIX, DLL_SUFFIX, EXE_SUFFIX},
path::Path,
};
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -19,7 +18,7 @@ async fn main() -> eyre::Result<()> {
if run_dora_runtime {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}
set_up_tracing().wrap_err("failed to set up tracing")?;
set_up_tracing("c++-dataflow-runner").wrap_err("failed to set up tracing")?;

if cfg!(windows) {
tracing::error!(
@@ -294,14 +293,3 @@ async fn build_cxx_operator(

Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/c-dataflow/run.rs View File

@@ -1,10 +1,9 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::{
env::consts::{DLL_PREFIX, DLL_SUFFIX, EXE_SUFFIX},
path::Path,
};
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -20,7 +19,7 @@ async fn main() -> eyre::Result<()> {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}

set_up_tracing().wrap_err("failed to set up tracing")?;
set_up_tracing("c-dataflow-runner").wrap_err("failed to set up tracing")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
@@ -182,14 +181,3 @@ async fn build_c_operator(root: &Path) -> eyre::Result<()> {

Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/cmake-dataflow/run.rs View File

@@ -1,7 +1,6 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::path::Path;
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -16,7 +15,7 @@ async fn main() -> eyre::Result<()> {
if run_dora_runtime {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}
set_up_tracing().wrap_err("failed to set up tracing")?;
set_up_tracing("cmake-dataflow-runner").wrap_err("failed to set up tracing")?;

if cfg!(windows) {
tracing::error!(
@@ -67,14 +66,3 @@ async fn build_package(package: &str) -> eyre::Result<()> {
}
Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/multiple-daemons/run.rs View File

@@ -3,6 +3,7 @@ use dora_core::{
descriptor::Descriptor,
topics::{ControlRequest, ControlRequestReply, DataflowId},
};
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use futures::stream;
use std::{
@@ -19,8 +20,6 @@ use tokio::{
task::JoinSet,
};
use tokio_stream::wrappers::ReceiverStream;
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;
use uuid::Uuid;

#[derive(Debug, Clone, clap::Parser)]
@@ -36,7 +35,7 @@ async fn main() -> eyre::Result<()> {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}

set_up_tracing().wrap_err("failed to set up tracing subscriber")?;
set_up_tracing("multiple-daemon-runner").wrap_err("failed to set up tracing subscriber")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
@@ -211,14 +210,3 @@ async fn build_dataflow(dataflow: &Path) -> eyre::Result<()> {
};
Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::TRACE);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 12
- 7
examples/python-dataflow/object_detection.py View File

@@ -1,14 +1,14 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from typing import Callable
from dora import Node

import cv2
import numpy as np
import torch
from ultralytics import YOLO

from dora import Node
import pyarrow as pa

model = torch.hub.load("ultralytics/yolov5", "yolov5n")
model = YOLO("yolov8n.pt")

node = Node()

@@ -22,9 +22,14 @@ for event in node:
frame = cv2.imdecode(frame, -1)
frame = frame[:, :, ::-1] # OpenCV image (BGR to RGB)
results = model(frame) # includes NMS
arrays = np.array(results.xyxy[0].cpu()).tobytes()
# Process results
boxes = np.array(results[0].boxes.xyxy.cpu())
conf = np.array(results[0].boxes.conf.cpu())
label = np.array(results[0].boxes.cls.cpu())
# concatenate them together
arrays = np.concatenate((boxes, conf[:, None], label[:, None]), axis=1)

node.send_output("bbox", arrays, event["metadata"])
node.send_output("bbox", pa.array(arrays.ravel()), event["metadata"])
else:
print("[object detection] ignoring unexpected input:", event_id)
elif event_type == "STOP":


+ 0
- 1
examples/python-dataflow/plot.py View File

@@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-

import os
from typing import Callable
from dora import Node
from dora import DoraStatus



+ 2
- 4
examples/python-dataflow/requirements.txt View File

@@ -14,10 +14,8 @@ PyYAML>=5.3.1
requests>=2.23.0
scipy>=1.4.1
thop>=0.1.1 # FLOPs computation
--extra-index-url https://download.pytorch.org/whl/cpu
torch>=1.7.0 # see https://pytorch.org/get-started/locally (recommended)
--extra-index-url https://download.pytorch.org/whl/cpu
torchvision>=0.8.1
torch # see https://pytorch.org/get-started/locally (recommended)
torchvision
tqdm>=4.64.0

# Logging -------------------------------------


+ 58
- 50
examples/python-dataflow/run.rs View File

@@ -1,79 +1,87 @@
use dora_core::{get_pip_path, get_python_path, run};
use dora_download::download_file;
use dora_tracing::set_up_tracing;
use eyre::{ContextCompat, WrapErr};
use std::path::Path;
use tracing_subscriber::{
filter::{FilterExt, LevelFilter},
prelude::*,
EnvFilter, Registry,
};

#[tokio::main]
async fn main() -> eyre::Result<()> {
set_up_tracing()?;
set_up_tracing("python-dataflow-runner")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
.wrap_err("failed to set working dir")?;

run(&["python3", "-m", "venv", "../.env"], None)
.await
.context("failed to create venv")?;
run(
get_python_path().context("Could not get python binary")?,
&["-m", "venv", "../.env"],
None,
)
.await
.context("failed to create venv")?;
let venv = &root.join("examples").join(".env");
std::env::set_var(
"VIRTUAL_ENV",
venv.to_str().context("venv path not valid unicode")?,
);
let orig_path = std::env::var("PATH")?;
let venv_bin = venv.join("bin");
std::env::set_var(
"PATH",
format!(
"{}:{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
// bin folder is named Scripts on windows.
// 🤦‍♂️ See: https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1
let venv_bin = if cfg!(windows) {
venv.join("Scripts")
} else {
venv.join("bin")
};

run(&["pip", "install", "--upgrade", "pip"], None)
.await
.context("failed to install pip")?;
run(&["pip", "install", "-r", "requirements.txt"], None)
.await
.context("pip install failed")?;
if cfg!(windows) {
std::env::set_var(
"PATH",
format!(
"{};{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
} else {
std::env::set_var(
"PATH",
format!(
"{}:{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
}

run(
get_python_path().context("Could not get pip binary")?,
&["-m", "pip", "install", "--upgrade", "pip"],
None,
)
.await
.context("failed to install pip")?;
run(
get_pip_path().context("Could not get pip binary")?,
&["install", "-r", "requirements.txt"],
None,
)
.await
.context("pip install failed")?;

run(
&["maturin", "develop"],
"maturin",
&["develop"],
Some(&root.join("apis").join("python").join("node")),
)
.await
.context("maturin develop failed")?;
download_file(
"https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt",
Path::new("yolov8n.pt"),
)
.await
.context("Could not download weights.")?;

let dataflow = Path::new("dataflow.yml");
dora_daemon::Daemon::run_dataflow(dataflow).await?;

Ok(())
}

async fn run(cmd: &[&str], pwd: Option<&Path>) -> eyre::Result<()> {
let mut run = tokio::process::Command::new(cmd[0]);
run.args(&cmd[1..]);

if let Some(pwd) = pwd {
run.current_dir(pwd);
}
if !run.status().await?.success() {
eyre::bail!("failed to run {cmd:?}");
};
Ok(())
}

pub fn set_up_tracing() -> eyre::Result<()> {
// Filter log using `RUST_LOG`. More useful for CLI.
let filter = EnvFilter::from_default_env().or(LevelFilter::DEBUG);
let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(filter);

let registry = Registry::default().with(stdout_log);

tracing::subscriber::set_global_default(registry)
.context("failed to set tracing global subscriber")
}

+ 0
- 7
examples/python-operator-dataflow/dataflow.yml View File

@@ -21,10 +21,3 @@ nodes:
inputs:
image: webcam/image
bbox: object_detection/bbox
- id: dora-record
custom:
build: cargo build -p dora-record
source: ../../target/debug/dora-record
inputs:
image: webcam/image
bbox: object_detection/bbox

+ 10
- 5
examples/python-operator-dataflow/object_detection.py View File

@@ -2,12 +2,11 @@
# -*- coding: utf-8 -*-


import cv2
import numpy as np
import pyarrow as pa
import torch

from dora import DoraStatus
from ultralytics import YOLO

pa.array([])

@@ -21,7 +20,7 @@ class Operator:
"""

def __init__(self):
self.model = torch.hub.load("ultralytics/yolov5", "yolov5n")
self.model = YOLO("yolov8n.pt")

def on_event(
self,
@@ -51,6 +50,12 @@ class Operator:
frame = dora_input["value"].to_numpy().reshape((CAMERA_HEIGHT, CAMERA_WIDTH, 3))
frame = frame[:, :, ::-1] # OpenCV image (BGR to RGB)
results = self.model(frame) # includes NMS
arrays = pa.array(np.array(results.xyxy[0].cpu()).ravel())
send_output("bbox", arrays, dora_input["metadata"])
# Process results
boxes = np.array(results[0].boxes.xyxy.cpu())
conf = np.array(results[0].boxes.conf.cpu())
label = np.array(results[0].boxes.cls.cpu())
# concatenate them together
arrays = np.concatenate((boxes, conf[:, None], label[:, None]), axis=1)

send_output("bbox", pa.array(arrays.ravel()), dora_input["metadata"])
return DoraStatus.CONTINUE

+ 6
- 9
examples/python-operator-dataflow/requirements.txt View File

@@ -3,19 +3,20 @@

# Base ----------------------------------------
ultralytics
gitpython
ipython # interactive notebook
matplotlib>=3.2.2
numpy>=1.18.5
opencv-python>=4.1.1
Pillow>=7.1.2
psutil # system resources
PyYAML>=5.3.1
requests>=2.23.0
scipy>=1.4.1
--extra-index-url https://download.pytorch.org/whl/cpu
torch>=1.7.0
--extra-index-url https://download.pytorch.org/whl/cpu
torchvision>=0.8.1
thop>=0.1.1 # FLOPs computation
torch # see https://pytorch.org/get-started/locally (recommended)
torchvision
tqdm>=4.64.0
protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012

# Logging -------------------------------------
tensorboard>=2.4.1
@@ -38,13 +39,9 @@ seaborn>=0.11.0
# openvino-dev # OpenVINO export

# Extras --------------------------------------
ipython # interactive notebook
psutil # system utilization
thop>=0.1.1 # FLOPs computation
# albumentations>=1.0.3
# pycocotools>=2.0 # COCO mAP
# roboflow

opencv-python>=4.1.1
pyarrow
maturin

+ 58
- 50
examples/python-operator-dataflow/run.rs View File

@@ -1,79 +1,87 @@
use dora_core::{get_pip_path, get_python_path, run};
use dora_download::download_file;
use dora_tracing::set_up_tracing;
use eyre::{ContextCompat, WrapErr};
use std::path::Path;
use tracing_subscriber::{
filter::{FilterExt, LevelFilter},
prelude::*,
EnvFilter, Registry,
};

#[tokio::main]
async fn main() -> eyre::Result<()> {
set_up_tracing()?;
set_up_tracing("python-operator-dataflow-runner")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
.wrap_err("failed to set working dir")?;

run(&["python3", "-m", "venv", "../.env"], None)
.await
.context("failed to create venv")?;
run(
get_python_path().context("Could not get python binary")?,
&["-m", "venv", "../.env"],
None,
)
.await
.context("failed to create venv")?;
let venv = &root.join("examples").join(".env");
std::env::set_var(
"VIRTUAL_ENV",
venv.to_str().context("venv path not valid unicode")?,
);
let orig_path = std::env::var("PATH")?;
let venv_bin = venv.join("bin");
std::env::set_var(
"PATH",
format!(
"{}:{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
// bin folder is named Scripts on windows.
// 🤦‍♂️ See: https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1
let venv_bin = if cfg!(windows) {
venv.join("Scripts")
} else {
venv.join("bin")
};

run(&["pip", "install", "--upgrade", "pip"], None)
.await
.context("failed to install pip")?;
run(&["pip", "install", "-r", "requirements.txt"], None)
.await
.context("pip install failed")?;
if cfg!(windows) {
std::env::set_var(
"PATH",
format!(
"{};{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
} else {
std::env::set_var(
"PATH",
format!(
"{}:{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
}

run(
get_python_path().context("Could not get pip binary")?,
&["-m", "pip", "install", "--upgrade", "pip"],
None,
)
.await
.context("failed to install pip")?;
run(
get_pip_path().context("Could not get pip binary")?,
&["install", "-r", "requirements.txt"],
None,
)
.await
.context("pip install failed")?;

run(
&["maturin", "develop"],
"maturin",
&["develop"],
Some(&root.join("apis").join("python").join("node")),
)
.await
.context("maturin develop failed")?;

download_file(
"https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt",
Path::new("yolov8n.pt"),
)
.await
.context("Could not download weights.")?;
let dataflow = Path::new("dataflow.yml");
dora_daemon::Daemon::run_dataflow(dataflow).await?;

Ok(())
}

async fn run(cmd: &[&str], pwd: Option<&Path>) -> eyre::Result<()> {
let mut run = tokio::process::Command::new(cmd[0]);
run.args(&cmd[1..]);

if let Some(pwd) = pwd {
run.current_dir(pwd);
}
if !run.status().await?.success() {
eyre::bail!("failed to run {cmd:?}");
};
Ok(())
}

pub fn set_up_tracing() -> eyre::Result<()> {
// Filter log using `RUST_LOG`. More useful for CLI.
let filter = EnvFilter::from_default_env().or(LevelFilter::DEBUG);
let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(filter);

let registry = Registry::default().with(stdout_log);

tracing::subscriber::set_global_default(registry)
.context("failed to set tracing global subscriber")
}

+ 52
- 53
examples/python-ros2-dataflow/run.rs View File

@@ -1,48 +1,73 @@
use dora_core::{get_pip_path, get_python_path, run};
use dora_tracing::set_up_tracing;
use eyre::{ContextCompat, WrapErr};
use std::path::Path;
use tracing_subscriber::{
filter::{FilterExt, LevelFilter},
prelude::*,
EnvFilter, Registry,
};

#[tokio::main]
async fn main() -> eyre::Result<()> {
set_up_tracing()?;
set_up_tracing("python-ros2-dataflow-runner")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
.wrap_err("failed to set working dir")?;

run(&["python3", "-m", "venv", "../.env"], None)
.await
.context("failed to create venv")?;
run(
get_python_path().context("Could not get python binary")?,
&["-m", "venv", "../.env"],
None,
)
.await
.context("failed to create venv")?;
let venv = &root.join("examples").join(".env");
std::env::set_var(
"VIRTUAL_ENV",
venv.to_str()
.context("venv path not valid unicode")?
.to_owned(),
venv.to_str().context("venv path not valid unicode")?,
);
let orig_path = std::env::var("PATH")?;
let venv_bin = venv.join("bin");
std::env::set_var(
"PATH",
format!(
"{}:{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
// bin folder is named Scripts on windows.
// 🤦‍♂️ See: https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1
let venv_bin = if cfg!(windows) {
venv.join("Scripts")
} else {
venv.join("bin")
};

run(&["pip", "install", "--upgrade", "pip"], None)
.await
.context("failed to install pip")?;
run(&["pip", "install", "-r", "requirements.txt"], None)
.await
.context("pip install failed")?;
if cfg!(windows) {
std::env::set_var(
"PATH",
format!(
"{};{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
} else {
std::env::set_var(
"PATH",
format!(
"{}:{orig_path}",
venv_bin.to_str().context("venv path not valid unicode")?
),
);
}

run(
get_python_path().context("Could not get pip binary")?,
&["-m", "pip", "install", "--upgrade", "pip"],
None,
)
.await
.context("failed to install pip")?;
run(
get_pip_path().context("Could not get pip binary")?,
&["install", "-r", "requirements.txt"],
None,
)
.await
.context("pip install failed")?;

run(
&["maturin", "develop"],
"maturin",
&["develop"],
Some(&root.join("apis").join("python").join("node")),
)
.await
@@ -53,29 +78,3 @@ async fn main() -> eyre::Result<()> {

Ok(())
}

async fn run(cmd: &[&str], pwd: Option<&Path>) -> eyre::Result<()> {
let mut run = tokio::process::Command::new(cmd[0]);
run.args(&cmd[1..]);

if let Some(pwd) = pwd {
run.current_dir(pwd);
}
if !run.status().await?.success() {
eyre::bail!("failed to run {cmd:?}");
};
Ok(())
}

pub fn set_up_tracing() -> eyre::Result<()> {
// Filter log using `RUST_LOG`. More useful for CLI.
let filter = EnvFilter::from_default_env().or(LevelFilter::DEBUG);
let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(filter);

let registry = Registry::default().with(stdout_log);

tracing::subscriber::set_global_default(registry)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/rust-dataflow-url/run.rs View File

@@ -1,7 +1,6 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::path::Path;
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -16,7 +15,7 @@ async fn main() -> eyre::Result<()> {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}

set_up_tracing().wrap_err("failed to set up tracing")?;
set_up_tracing("rust-dataflow-url-runner").wrap_err("failed to set up tracing")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
@@ -41,14 +40,3 @@ async fn build_dataflow(dataflow: &Path) -> eyre::Result<()> {
};
Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/rust-dataflow/run.rs View File

@@ -1,7 +1,6 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::path::Path;
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -17,7 +16,7 @@ async fn main() -> eyre::Result<()> {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}

set_up_tracing().wrap_err("failed to set up tracing subscriber")?;
set_up_tracing("rust-dataflow-runner").wrap_err("failed to set up tracing subscriber")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
@@ -42,14 +41,3 @@ async fn build_dataflow(dataflow: &Path) -> eyre::Result<()> {
};
Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 14
examples/rust-ros2-dataflow/run.rs View File

@@ -1,7 +1,6 @@
use dora_tracing::set_up_tracing;
use eyre::{bail, Context};
use std::path::Path;
use tracing::metadata::LevelFilter;
use tracing_subscriber::Layer;

#[derive(Debug, Clone, clap::Parser)]
pub struct Args {
@@ -17,7 +16,7 @@ async fn main() -> eyre::Result<()> {
return tokio::task::block_in_place(dora_daemon::run_dora_runtime);
}

set_up_tracing().wrap_err("failed to set up tracing subscriber")?;
set_up_tracing("rust-ros2-dataflow-runner").wrap_err("failed to set up tracing subscriber")?;

let root = Path::new(env!("CARGO_MANIFEST_DIR"));
std::env::set_current_dir(root.join(file!()).parent().unwrap())
@@ -42,14 +41,3 @@ async fn build_dataflow(dataflow: &Path) -> eyre::Result<()> {
};
Ok(())
}

fn set_up_tracing() -> eyre::Result<()> {
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;

let stdout_log = tracing_subscriber::fmt::layer()
.pretty()
.with_filter(LevelFilter::DEBUG);
let subscriber = tracing_subscriber::Registry::default().with(stdout_log);
tracing::subscriber::set_global_default(subscriber)
.context("failed to set tracing global subscriber")
}

+ 2
- 2
libraries/core/Cargo.toml View File

@@ -14,10 +14,10 @@ serde = { version = "1.0.136", features = ["derive"] }
serde_yaml = "0.9.11"
serde_bytes = "0.11.12"
once_cell = "1.13.0"
which = "4.3.0"
which = "5.0.0"
uuid = { version = "1.2.1", features = ["serde"] }
dora-message = { workspace = true }
tracing = "0.1"
serde-with-expand-env = "1.1.0"
tokio = { version = "1.24.1", features = ["fs"] }
tokio = { version = "1.24.1", features = ["fs", "process"] }
aligned-vec = { version = "0.5.0", features = ["serde"] }

+ 2
- 1
libraries/core/src/descriptor/validate.rs View File

@@ -2,6 +2,7 @@ use crate::{
adjust_shared_library_path,
config::{DataId, Input, InputMapping, OperatorId, UserInputMapping},
descriptor::{self, source_is_url, CoreNodeKind, OperatorSource},
get_python_path,
};

use eyre::{bail, eyre, Context};
@@ -152,7 +153,7 @@ fn check_python_runtime() -> eyre::Result<()> {
// Check if python dora-rs is installed and match cli version
let reinstall_command =
format!("Please reinstall it with: `pip install dora-rs=={VERSION} --force`");
let mut command = Command::new("python3");
let mut command = Command::new(get_python_path().context("Could not get python binary")?);
command.args([
"-c",
&format!(


+ 44
- 1
libraries/core/src/lib.rs View File

@@ -1,6 +1,7 @@
use eyre::{bail, eyre};
use eyre::{bail, eyre, Context};
use std::{
env::consts::{DLL_PREFIX, DLL_SUFFIX},
ffi::OsStr,
path::Path,
};

@@ -30,3 +31,45 @@ pub fn adjust_shared_library_path(path: &Path) -> Result<std::path::PathBuf, eyr
let path = path.with_file_name(library_filename);
Ok(path)
}

// Search for python binary.
// Match `python` for windows and `python3` for other platforms.
pub fn get_python_path() -> Result<std::path::PathBuf, eyre::ErrReport> {
let python = if cfg!(windows) {
which::which("python")
.context("failed to find `python` or `python3`. Make sure that python is available.")?
} else {
which::which("python3")
.context("failed to find `python` or `python3`. Make sure that python is available.")?
};
Ok(python)
}

// Search for pip binary.
// First search for `pip3` as for ubuntu <20, `pip` can resolves to `python2,7 -m pip`
// Then search for `pip`, this will resolve for windows to python3 -m pip.
pub fn get_pip_path() -> Result<std::path::PathBuf, eyre::ErrReport> {
let python = match which::which("pip3") {
Ok(python) => python,
Err(_) => which::which("pip")
.context("failed to find `pip3` or `pip`. Make sure that python is available.")?,
};
Ok(python)
}

// Helper function to run a program
pub async fn run<S>(program: S, args: &[&str], pwd: Option<&Path>) -> eyre::Result<()>
where
S: AsRef<OsStr>,
{
let mut run = tokio::process::Command::new(program);
run.args(args);

if let Some(pwd) = pwd {
run.current_dir(pwd);
}
if !run.status().await?.success() {
eyre::bail!("failed to run {args:?}");
};
Ok(())
}

+ 1
- 1
libraries/extensions/download/Cargo.toml View File

@@ -11,7 +11,7 @@ license.workspace = true
[dependencies]
eyre = "0.6.8"
reqwest = { version = "0.11.12", default-features = false, features = [
"rustls",
"rustls-tls",
] }
tokio = { version = "1.24.2", features = ["fs"] }
tracing = "0.1.36"

Loading…
Cancel
Save