Browse Source

reintroduce `DoraStatus`

tags/v0.3.4-rc1
haixuanTao 2 years ago
parent
commit
97c2dabdd7
2 changed files with 15 additions and 3 deletions
  1. +13
    -0
      apis/python/node/dora/__init__.py
  2. +2
    -3
      binaries/runtime/src/operator/python.rs

+ 13
- 0
apis/python/node/dora/__init__.py View File

@@ -26,3 +26,16 @@ from .dora import (
Ros2Durability,
Ros2Liveliness,
)


class DoraStatus(Enum):
"""Dora status to indicate if operator `on_input` loop
should be stopped.
Args:
Enum (u8): Status signaling to dora operator to
stop or continue the operator.
"""

CONTINUE = 0
STOP = 1
STOP_ALL = 2

+ 2
- 3
binaries/runtime/src/operator/python.rs View File

@@ -224,9 +224,8 @@ pub fn run(
.map_err(traceback);
match status_enum {
Ok(status_enum) => {
let status_val =
Python::with_gil(|py| status_enum.call_method0(py, "value"))
.wrap_err("on_event must have enum return value")?;
let status_val = Python::with_gil(|py| status_enum.getattr(py, "value"))
.wrap_err("on_event must have enum return value")?;
Python::with_gil(|py| status_val.extract(py))
.wrap_err("on_event has invalid return value")
}


Loading…
Cancel
Save