Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fe85549
Basic boilerplate and a failing test
vitarb Mar 8, 2021
933039b
recent progress
vitarb Mar 8, 2021
af62299
fix compilation issues and add proto messages
vitarb Mar 9, 2021
dfde0bf
Convert ActivityCommand in WFMachinesAdapter
vitarb Mar 9, 2021
72fa5f7
Add CommandSender for activity in the workflow driver
vitarb Mar 9, 2021
1d33414
Add TryFrom for CommandType and make the test pass
vitarb Mar 9, 2021
7aead98
Add core API for polling activities
vitarb Mar 11, 2021
45b5176
Add complete activity task API to the core
vitarb Mar 15, 2021
dd1ecbf
Return cancellation result back
vitarb Mar 15, 2021
6afa486
State machine changes for activity completion
vitarb Mar 15, 2021
164fbac
update pattern
vitarb Mar 15, 2021
a561436
Add handling for failure/cancelation in completion API
vitarb Mar 15, 2021
1b9416e
Pushing to show what I have so far to Roey
Sushisource Mar 18, 2021
4a395ab
Push in progress commands for Roey
Sushisource Mar 18, 2021
f33dce7
PR feedback -- still need to now fix all the Rust code.
Sushisource Mar 18, 2021
826c67e
Merge branch 'master' into eliminate-upstream-protos
Sushisource Mar 18, 2021
de0b9b0
Basic boilerplate and a failing test
vitarb Mar 8, 2021
2baa39e
recent progress
vitarb Mar 8, 2021
e7e3de2
fix compilation issues and add proto messages
vitarb Mar 9, 2021
95084c4
Convert ActivityCommand in WFMachinesAdapter
vitarb Mar 9, 2021
d066943
Add CommandSender for activity in the workflow driver
vitarb Mar 9, 2021
8dec63a
Add TryFrom for CommandType and make the test pass
vitarb Mar 9, 2021
abdbb6b
Add core API for polling activities
vitarb Mar 11, 2021
d6171cf
Add complete activity task API to the core
vitarb Mar 15, 2021
e48d1c4
Return cancellation result back
vitarb Mar 15, 2021
565d692
State machine changes for activity completion
vitarb Mar 15, 2021
df3d624
update pattern
vitarb Mar 15, 2021
62d9b3f
Add handling for failure/cancelation in completion API
vitarb Mar 15, 2021
1054643
End to end flow with test
vitarb Mar 18, 2021
f3bb00c
fmt
vitarb Mar 18, 2021
b9616dd
Address some CR comments
vitarb Mar 18, 2021
bac0197
Remove redundant test
vitarb Mar 19, 2021
891a18a
use command id enum as the issued_commands map key
vitarb Mar 19, 2021
a6103c1
rename enum params
vitarb Mar 19, 2021
81c73ed
Add end-to-end integration test
vitarb Mar 19, 2021
1fb36dc
complete wf
vitarb Mar 19, 2021
64e1f90
make id to machine map keyed of command id
vitarb Mar 19, 2021
8a7d480
Fix 8 billion compile errors
Sushisource Mar 22, 2021
4a9fc05
Cleanup unused imports
Sushisource Mar 22, 2021
f38a527
Merge branch 'activity' into eliminate-upstream-protos
Sushisource Mar 22, 2021
1595d86
Fix problems from merge
Sushisource Mar 22, 2021
9c222c2
Clippy fix
Sushisource Mar 22, 2021
2b2ff2f
Merge branch 'master' into eliminate-upstream-protos
Sushisource Mar 22, 2021
47b9f43
Git you can sure be dumb sometimes
Sushisource Mar 22, 2021
2db7adc
Some import cleanup
Sushisource Mar 22, 2021
fddb40c
Integ test fixes
Sushisource Mar 22, 2021
b7e6dca
Realized integ test was not getting linted
Sushisource Mar 22, 2021
e3ba488
Forgot to remove intentional lint failure while testing
Sushisource Mar 23, 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
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ steps:
agents:
queue: "default"
docker: "*"
command: "cargo clippy --all -- -D warnings"
command: "cargo clippy --workspace --all-features --all-targets -- -D warnings && cargo clippy --test integ_tests --all-features -- --D warnings"
timeout_in_minutes: 15
plugins:
- docker-compose#v3.0.0:
Expand Down
12 changes: 9 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +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.WFActivationJob", "#[derive(::derive_more::From)]")
.type_attribute(
"coresdk.WFActivationJob.variant",
"coresdk.workflow_commands.WorkflowCommand.variant",
"#[derive(::derive_more::From)]",
)
.type_attribute(
"coresdk.workflow_activation.wf_activation_job",
"#[derive(::derive_more::From)]",
)
.type_attribute(
"coresdk.workflow_activation.WFActivationJob.variant",
"#[derive(::derive_more::From)]",
)
.type_attribute("coresdk.Task.variant", "#[derive(::derive_more::From)]")
Expand Down
30 changes: 30 additions & 0 deletions protos/local/activity_result.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";

package coresdk.activity_result;

import "common.proto";

/// Used to report activity completion to core and to resolve the activity in a workflow activation
message ActivityResult {
oneof status {
Success completed = 1;
Failure failed = 2;
Cancelation canceled = 3;
}
}

/// Used in ActivityResult to report cancellation
message Cancelation {
repeated common.Payload details = 1;
}

/// Used in ActivityResult to report successful completion
message Success {
repeated common.Payload result = 1;
}

/// Used in ActivityResult to report failure
message Failure {
common.UserCodeFailure failure = 1;
}

55 changes: 55 additions & 0 deletions protos/local/activity_task.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
syntax = "proto3";

/**
* Definitions of the different activity tasks returned from [crate::Core::poll_task].
*/
package coresdk.activity_task;

import "common.proto";

import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";

message ActivityTask {
string activity_id = 1;
oneof variant {
// Start activity execution.
Start start = 2;
// Attempt to cancel activity execution.
Cancel cancel = 3;
}
}

/// Begin executing an activity
message Start {
string workflow_namespace = 1;
/// The workflow's type name or function identifier
string workflow_type = 2;
common.WorkflowExecution workflow_execution = 3;
/// The activity's type name or function identifier
string activity_type = 4;
map<string, common.Payload> header_fields = 5;
/// Arguments to the activity
repeated common.Payload input = 6;
repeated common.Payload heartbeat_details = 7;

google.protobuf.Timestamp scheduled_time = 8;
google.protobuf.Timestamp current_attempt_scheduled_time = 9;
google.protobuf.Timestamp started_time = 10;
int32 attempt = 11;

google.protobuf.Duration schedule_to_close_timeout = 12;
google.protobuf.Duration start_to_close_timeout = 13;
google.protobuf.Duration heartbeat_timeout = 14;
/// This is an actual retry policy the service uses. It can be different from the one provided
/// (or not) during activity scheduling as the service can override the provided one in case its
/// values are not specified or exceed configured system limits.
common.RetryPolicy retry_policy = 15;
}

/// Attempt to cancel a running activity
message Cancel {
// TODO: add attributes
}


61 changes: 61 additions & 0 deletions protos/local/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
syntax = "proto3";

package coresdk.common;

import "google/protobuf/duration.proto";

// Many of the messages in here are exact or near duplicates of the protobufs defined by the
// Temporal API. We dupe them here to introduce better ergonomics wherever possible, and to
// decouple ourselves from upstream changes. Additionally, we have no need for wire compatibility
// between core and lang sdks, since the lang SDK chooses which version of core it wants to use.

// Used as arguments to activities, signals, queries, etc.
message Payload {
map<string,bytes> metadata = 1;
bytes data = 2;
}

// Identifying information about a particular workflow execution
message WorkflowExecution {
string workflow_id = 1;
string run_id = 2;
}

// Defines how an activity or workflow should be retried in the event of failure, timeout, etc.
message RetryPolicy {
// Interval of the first retry. If backoff_coefficient is 1.0 then it is used for all
// retries.
google.protobuf.Duration initial_interval = 1;
// Coefficient used to calculate the next retry interval. The next retry interval is previous
// interval multiplied by the coefficient. Must be 1 or larger.
double backoff_coefficient = 2;
// Maximum interval between retries. Exponential backoff leads to interval increase. This value
// caps that interval. Default is 100x of the initial interval.
google.protobuf.Duration maximum_interval = 3;
// Maximum number of attempts. When exceeded, retrying will stop. 1 disables retries. 0 means
// unlimited retries (until the activity or workflow's total timeout is reached).
int32 maximum_attempts = 4;
// If a stringified error matches something in this list, retries will cease.
repeated string non_retryable_error_types = 5;
}

// Represents a failure in user code, workflow or activity, which could've been triggered by
// an exception or similar error mechanism like the error half of a Result type.
//
// This eventually needs to be converted into an upstream `Failure` which needs to handle a lot
// more cases that the lang sdk does not care about. By default any lang sdk failure is an upstream
// `ApplicationFailureInfo`.
message UserCodeFailure {
// Human-specified or otherwise most-human-readable representation of the error.
string message = 1;
// A type identifier for the error, if the error is well-typed.
string type = 2;
// If known, the location the error was issued at.
string source = 3;
// If collected, a stack trace for the error.
string stack_trace = 4;
// Explicitly thrown user errors are able to indicate that retries should be prevented
bool non_retryable = 5;

UserCodeFailure cause = 6;
}
Loading