-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support array result include sequence action #39
Support array result include sequence action #39
Conversation
The rust supports sequence action by default, test steps as below
extern crate serde_json;
use serde_derive::{Deserialize, Serialize};
use serde_json::{Error, Value};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Input {
#[serde(default = "stranger")]
name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Output {
greeting: String,
}
fn stranger() -> String {
"stranger".to_string()
}
pub fn main(args: Value) -> Result<Value, Error> {
// has no split, just return array, need to receive this value in next action(sort)
let output = ["a", "b"];
serde_json::to_value(output)
}
extern crate serde_json;
use serde_derive::{Deserialize, Serialize};
use serde_json::{Error, Value};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Input {
#[serde(default = "stranger")]
name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Output {
greeting: String,
}
fn stranger() -> String {
"stranger".to_string()
}
pub fn main(args: Value) -> Result<Value, Error> {
println!("param args is {}", args);
let inputParam = args.as_array();
println!("input param as array is {:?}", inputParam);
let defaultOutput = ["finally-a", "finally-b"];
match inputParam {
None => serde_json::to_value(defaultOutput),
Some(x) => serde_json::to_value(x),
}
}
wsk -i action create /whisk.system/utils/split-rust --kind rust:1.34 ~/split.rs
wsk -i action create /whisk.system/utils/sort-rust --kind rust:1.34 ~/sort.rs
wsk -i action create mySequence-rust --sequence /whisk.system/utils/split-rust,/whisk.system/utils/sort-rust
wsk -i action invoke --result mySequence-rust -r -v refer to: https://docs.serde.rs/serde_json/value/enum.Value.html |
dc405c3
to
20dc889
Compare
core/rust1.34/Dockerfile
Outdated
|
||
FROM rust:1.34 | ||
|
||
# select the builder to use | ||
ARG GO_PROXY_BUILD_FROM=release | ||
ARG GO_PROXY_BUILD_FROM=source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change it to release
due to apache/openwhisk-runtime-java#140 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already changed to release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Depend on below prs:
Support array result for common action and sequence action openwhisk#5290
Support array result include sequence action openwhisk-runtime-go#170
Support array result