Skip to content

Commit 7dff4d7

Browse files
committed
fix: minor bugs
1 parent 92292f7 commit 7dff4d7

6 files changed

Lines changed: 129 additions & 8 deletions

File tree

Cargo.lock

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tonic-health = "0.14.1"
2222
tonic = "0.14.1"
2323
serde_json = "1.0.149"
2424
serde = "1.0.228"
25-
25+
uuid = { version = "1.23.0", features = ["v4"] }
2626
[workspace.dependencies.taurus-core]
2727
path = "./crates/core"
2828

crates/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ rand = { workspace = true }
1010
log = { workspace = true }
1111
futures-lite = { workspace = true }
1212
async-trait = { workspace = true }
13+
uuid = { workspace = true }
1314

crates/core/src/context/executor.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use tucana::aquila::ExecutionRequest;
3636
use tucana::shared::reference_value::Target;
3737
use tucana::shared::value::Kind;
3838
use tucana::shared::{NodeFunction, Struct, Value};
39+
use uuid::Uuid;
3940

4041
/// Executes a flow graph by repeatedly evaluating nodes.
4142
///
@@ -223,7 +224,7 @@ impl<'a> Executor<'a> {
223224
};
224225

225226
let remote_result =
226-
block_on(remote.execute_remote(node.runtime_function_id.clone(), request));
227+
block_on(remote.execute_remote(node.definition_source.clone(), request));
227228
let signal = match remote_result {
228229
Ok(value) => Signal::Success(value),
229230
Err(err) => Signal::Failure(err),
@@ -583,9 +584,9 @@ impl<'a> Executor<'a> {
583584
for (param, value) in node.parameters.iter().zip(values.into_iter()) {
584585
fields.insert(param.runtime_parameter_id.clone(), value);
585586
}
586-
587+
let id = Uuid::new_v4();
587588
Ok(ExecutionRequest {
588-
execution_identifier: format!("node-{}", node.database_id),
589+
execution_identifier: id.to_string(),
589590
function_identifier: node.runtime_function_id.clone(),
590591
parameters: Some(Struct { fields }),
591592
project_id: 0,

crates/manual/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ impl RemoteRuntime for RemoteNatsClient {
3333
) -> Result<Value, RuntimeError> {
3434
let topic = format!("action.{}.{}", remote_name, request.execution_identifier);
3535
let payload = request.encode_to_vec();
36-
let res = self.client.request(topic, payload.into()).await;
36+
let res = self.client.request(topic.clone(), payload.into()).await;
37+
log::info!("Publishing to topic: {}", topic);
3738
let message = match res {
3839
Ok(r) => r,
39-
Err(_) => {
40-
return Err(RuntimeError::simple_str(
40+
Err(err) => {
41+
return Err(RuntimeError::simple(
4142
"RemoteRuntimeExeption",
42-
"Failed to handle NATS message",
43+
format!("Failed to handle NATS message {:?}", err),
4344
));
4445
}
4546
};

flows/04_example_action.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "04_example_action",
3+
"description": "This flow expects a simple http response object as the return value",
4+
"inputs": [
5+
{
6+
"input": null,
7+
"expected_result": {
8+
"status_code": 200,
9+
"headers": {
10+
"Header": "X"
11+
},
12+
"payload": "Hello World"
13+
}
14+
}
15+
],
16+
"flow": {
17+
"starting_node_id": "1",
18+
"node_functions": [
19+
{
20+
"definition_source": "example",
21+
"databaseId": "1",
22+
"runtimeFunctionId": "fib",
23+
"parameters": [
24+
{
25+
"databaseId": "4",
26+
"runtimeParameterId": "http_response",
27+
"value": {
28+
"literalValue": {
29+
"numberValue": {
30+
"integer": 10
31+
}
32+
}
33+
}
34+
}
35+
]
36+
}
37+
]
38+
}
39+
}

0 commit comments

Comments
 (0)