Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3b974d1
Pretty far with impl, but just ran into big generic wall.
Sushisource Jan 19, 2021
0ee244b
Test helper translation mostly done. Need to dedupe.
Sushisource Jan 20, 2021
dd5f544
Cleanup to make things cleaner with peeking. Dedupe not worth it.
Sushisource Jan 20, 2021
bf60b34
Need to implement non_stateful_event
Sushisource Jan 20, 2021
495ba2b
More progress. In the middle of implementing non stateful event handler.
Sushisource Jan 20, 2021
84a3fe4
Merge branch 'master' into implement-workflow-machines
Sushisource Jan 20, 2021
bc0dd18
Implement event dispatch pattern & add visibility to fsm!
Sushisource Jan 20, 2021
a23441d
Workflow task state machine partially implemented
Sushisource Jan 20, 2021
2120430
Saving progress. Halfway through detangling workflow task machine cal…
Sushisource Jan 21, 2021
911db19
Annoying function factoring
Sushisource Jan 21, 2021
2de4a50
Cleanup, got to timer started command
Sushisource Jan 21, 2021
eeb723a
Remove unneded trait
Sushisource Jan 21, 2021
5b46c78
Now need to implement handle command event! brr brr brr
Sushisource Jan 21, 2021
66dc259
Moving to deskstop
Sushisource Jan 21, 2021
aefb9b9
Managed to get past gnarly borrow checker problems
Sushisource Jan 21, 2021
fb2671e
So close! Just producing wrong cmd at end
Sushisource Jan 21, 2021
20eec95
Erroneous command is gone. Just need to trigger WF completion
Sushisource Jan 21, 2021
576bfcf
Things are coming together! Just need to add a complete workflow machine
Sushisource Jan 22, 2021
fef3c32
Woohooo! This is pretty much working. Spitting out an extra command, …
Sushisource Jan 22, 2021
9f09a0a
Clean up clippy warnings for tomorrow me
Sushisource Jan 22, 2021
157a9ab
Checkpointing before I use tracing to make this more understandable
Sushisource Jan 23, 2021
1186d24
Tracing makes debug easier
Sushisource Jan 24, 2021
a5d0a04
IDE just didn't commit a bunch of stuff, cool.
Sushisource Jan 24, 2021
d0f5343
Test helpers to own modules before rework
Sushisource Jan 24, 2021
54246bd
Modify interface
Jan 24, 2021
af6c682
Moving back to desktop
Sushisource Jan 25, 2021
05768de
Nice! Refactoring to allow handling *just* machine commands. Remove T…
Sushisource Jan 25, 2021
84b717a
Add new way to create the timers with completion future
Sushisource Jan 25, 2021
b499fa9
Getting real close. Just need to wrap the command sink to be able to …
Sushisource Jan 25, 2021
f0f9562
Remarkably close. Saving this before trying slot type approach
Sushisource Jan 26, 2021
d42c549
Done! YAY!
Sushisource Jan 26, 2021
a45a1cc
Clippy fixes
Sushisource Jan 26, 2021
1a44f34
Remove/fix some todos
Sushisource Jan 26, 2021
3d0d4eb
Missed a word
Sushisource Jan 26, 2021
df99d7e
Remove Sync+Send impl for CoreSDKInitOptions
Jan 26, 2021
8ef8bba
Add workflow_id to SDKWFTask
Jan 26, 2021
aaf3c65
Simple rename / comment upgrade
Sushisource Jan 26, 2021
fbb27b0
Merge remote-tracking branch 'origin/implement-workflow-machines' int…
Sushisource Jan 26, 2021
30cb2aa
Merge branch 'implement-workflow-machines' into interface-design
Sushisource Jan 26, 2021
9d5fec0
Fix up clippy lints and remove async from sdk trait
Sushisource Jan 26, 2021
38e8e89
Add autoconversion to make life easier for lang side proto construction
Sushisource Jan 26, 2021
fc25233
Some prototyping of how we might glue FSMs to CoreService
Sushisource Jan 27, 2021
7d26c3c
Define an SDK Command type
Jan 27, 2021
ac75640
Made some reasonable progress. Trying to figure out how to push comma…
Sushisource Jan 27, 2021
1b1e3c9
Merge remote-tracking branch 'origin/interface-design' into interface…
Sushisource Jan 27, 2021
757eb56
Merge branch 'master' into interface-design
Sushisource Jan 27, 2021
1eed2cb
Pushing broken stuff so can pair w/ Vitaly
Sushisource Jan 28, 2021
9a61adb
Make stuff compile
vitarb Jan 28, 2021
5cb642f
Set us up for tomorrow
Sushisource Jan 28, 2021
f102bb2
Remove SDK prefix and refine interface a bit
Jan 28, 2021
f03824c
Made enough meaningful progress
vitarb Jan 28, 2021
cb88807
Amend the core interface with meeting conclusions
bergundy Jan 28, 2021
90c8468
Compile fix
Sushisource Jan 28, 2021
55d26db
Clean up one of the more obnoxious proto conversion chains
Sushisource Jan 28, 2021
a4723a3
Dumping all the stuff
vitarb Jan 28, 2021
a136972
Merge
vitarb Jan 29, 2021
9cac8b6
compiling
vitarb Jan 29, 2021
4e15a15
add assertion
vitarb Jan 29, 2021
8f541fc
Upgrade histinfo test a bit
Sushisource Jan 29, 2021
b2838c9
Add comments etc from our meet with Max
Sushisource Jan 29, 2021
8e9016c
Woo! Test is going. Need to do some cleanup and need to pump tasks *o…
Sushisource Jan 29, 2021
b24aa33
:tada: The test works! The activations go out! Commands come in! Clea…
Sushisource Jan 29, 2021
51f75d9
Just a smidge of cleanup
Sushisource Jan 29, 2021
e6a2436
Use run id instead of wfid
Sushisource Jan 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "sdk-core"
name = "temporal-sdk-core"
version = "0.1.0"
authors = ["Spencer Judge <spencer@temporal.io>", "Vitaly Arbuzov <vitaly@temporal.io>"]
edition = "2018"
Expand All @@ -10,6 +10,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0"
async-trait = "0.1"
dashmap = "4.0"
derive_more = "0.99"
env_logger = "0.8"
futures = "0.3"
Expand All @@ -28,6 +29,8 @@ tracing-subscriber = "0.2"
path = "fsm"

[dev-dependencies]
assert_matches = "1.4"
mockall = "0.9"
rstest = "0.6"

[build-dependencies]
Expand Down
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"temporal.api.command.v1.Command.attributes",
"#[derive(::derive_more::From)]",
)
.type_attribute("coresdk.Command.variant", "#[derive(::derive_more::From)]")
.type_attribute(
"coresdk.WFActivation.attributes",
"#[derive(::derive_more::From)]",
)
.type_attribute(
"coresdk.WorkflowTask.attributes",
"#[derive(::derive_more::From)]",
)
.type_attribute("coresdk.Task.variant", "#[derive(::derive_more::From)]")
.compile(
&[
"protos/local/core_interface.proto",
Expand Down
41 changes: 0 additions & 41 deletions fsm/state_machine_procmacro/tests/progress.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,8 @@
extern crate state_machine_trait as rustfsm;

use state_machine_trait::TransitionResult;
use std::convert::Infallible;

#[test]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/trybuild/*_pass.rs");
t.compile_fail("tests/trybuild/*_fail.rs");
}

// Kept here to inspect manual expansion
state_machine_procmacro::fsm! {
name SimpleMachine; command SimpleMachineCommand; error Infallible;

One --(A(String), foo)--> Two;
One --(B)--> Two;
Two --(B)--> One;
Two --(C, baz)--> One
}

#[derive(Default, Clone)]
pub struct One {}
impl One {
fn foo(self, _: String) -> SimpleMachineTransition {
TransitionResult::default::<Two>()
}
}
impl From<Two> for One {
fn from(_: Two) -> Self {
One {}
}
}

#[derive(Default, Clone)]
pub struct Two {}
impl Two {
fn baz(self) -> SimpleMachineTransition {
TransitionResult::default::<One>()
}
}
impl From<One> for Two {
fn from(_: One) -> Self {
Two {}
}
}

pub enum SimpleMachineCommand {}
102 changes: 62 additions & 40 deletions protos/local/core_interface.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,91 +6,113 @@ package coresdk;
// the include paths. You can make it work by going to the "Protobuf Support" settings section
// and adding the "api_upstream" subdir as an include path.

import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "dependencies/gogoproto/gogo.proto";
import "temporal/api/workflowservice/v1/request_response.proto";
import "temporal/api/taskqueue/v1/message.proto";
import "temporal/api/enums/v1/failed_cause.proto";
import "temporal/api/failure/v1/message.proto";
import "temporal/api/common/v1/message.proto";
import "temporal/api/command/v1/message.proto";

// TODO: SDK prefix in front of everything is maybe pointless given it's all within this package

service CoreSDKService {
rpc PollSDKTask (PollSDKTaskReq) returns (PollSDKTaskResp) {}
rpc CompleteSDKTask (CompleteSDKTaskReq) returns (CompleteSDKTaskResp) {}
service Core {
rpc PollTask (PollTaskReq) returns (Task) {}
rpc CompleteTask (CompleteTaskReq) returns (google.protobuf.Empty) {}
}

message PollSDKTaskReq {
// Maybe? Not sure it makes sense to support multiple workers in the same core sdk instance
repeated temporal.api.taskqueue.v1.TaskQueue task_queues = 1;
message PollTaskReq {
bool workflows = 1;
bool activities = 2;
}

message PollSDKTaskResp {
message Task {
bytes task_token = 1;
oneof task {
SDKWFTask wf_task = 2;
SDKActivityTask activity_task = 3;
oneof variant {
WFActivation workflow = 2;
ActivityTask activity = 3;
}
}

message SDKWFTask {
// Original task from temporal service
temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse original = 1;
message StartWorkflowTaskAttributes {
string namespace = 1;
string workflow_id = 3;
string name = 4;
temporal.api.common.v1.Payloads arguments = 5;
// will be others - workflow exe started attrs, etc
}

// maybe we just go back to timer fired to keep consistent
message UnblockTimerTaskAttributes {
string timer_id = 1;
}

message SDKActivityTask {
message WFActivation {
google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true];
string run_id = 2;
oneof attributes {
// could literally be attributes from events -- maybe we don't need our own types
StartWorkflowTaskAttributes start_workflow = 3;
UnblockTimerTaskAttributes unblock_timer = 4;
}
}

message ActivityTask {
// Original task from temporal service
temporal.api.workflowservice.v1.PollActivityTaskQueueResponse original = 1;
}


message CompleteSDKTaskReq {
message CompleteTaskReq {
bytes task_token = 1;
oneof completion {
SDKWFTaskCompletion workflow = 2;
SDKActivityTaskCompletion activity = 3;
WFActivationCompletion workflow = 2;
ActivityTaskCompletion activity = 3;
}
}

message CompleteSDKTaskResp {}

message SDKWFTaskCompletion {
message WFActivationCompletion {
oneof status {
SDKWFTaskSuccess successful = 1;
SDKWFTaskFailure failed = 2;
WFActivationSuccess successful = 1;
WFActivationFailure failed = 2;
}
}

message SDKActivityTaskCompletion {
message ActivityTaskCompletion {
oneof status {
SDKActivityTaskSuccess successful = 1;
SDKActivityTaskFailure failed = 2;
ActivityTaskSuccess successful = 1;
ActivityTaskFailure failed = 2;
}
}

message SDKWFTaskSuccess {
repeated SDKWFCommand commands = 1;
message CoreCommand {
// Reserved for specific commands
}

message Command {
oneof variant {
temporal.api.command.v1.Command api = 1;
CoreCommand core = 2;
}
}

message WFActivationSuccess {
repeated Command commands = 1;
// Other bits from RespondWorkflowTaskCompletedRequest as needed
}

message SDKWFTaskFailure {
message WFActivationFailure {
temporal.api.enums.v1.WorkflowTaskFailedCause cause = 1;
temporal.api.failure.v1.Failure failure = 2;
// Other bits from RespondWorkflowTaskFailedRequest as needed
}

message SDKActivityTaskSuccess {
message ActivityTaskSuccess {
temporal.api.common.v1.Payloads result = 1;
// Other bits from RespondActivityTaskCompletedRequest as needed
}
message SDKActivityTaskFailure {

message ActivityTaskFailure {
temporal.api.failure.v1.Failure failure = 1;
// Other bits from RespondActivityTaskFailedRequest as needed
}

message SDKWFCommand {
oneof command {
// Commands go here. Should we reuse and add on top of the originals?
// https://github.com/temporalio/api/blob/master/temporal/api/command/v1/message.proto#L174
bool nothing = 1;
}
}
Loading