Browse Source

Make `drop_operator` function optional

tags/v0.0.0-test.4
Philipp Oppermann 3 years ago
parent
commit
eb68070855
2 changed files with 8 additions and 6 deletions
  1. +0
    -3
      runtime/examples/python-operator/op.py
  2. +8
    -3
      runtime/src/operator/python.rs

+ 0
- 3
runtime/examples/python-operator/op.py View File

@@ -1,9 +1,6 @@
class Operator:
def __init__(self, counter=0):
self.counter = counter

def drop_operator(self):
print('drop python operator')
def on_input(self, id, value, send_output):
val_len = len(value)


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

@@ -68,9 +68,14 @@ pub fn spawn(
.wrap_err("on_input failed")?;
}

operator
.call_method0("drop_operator")
.wrap_err("drop_operator failed")?;
if operator
.hasattr("drop_operator")
.wrap_err("failed to look for drop_operator")?
{
operator
.call_method0("drop_operator")
.wrap_err("drop_operator failed")?;
}

Result::<_, eyre::Report>::Ok(())
};


Loading…
Cancel
Save