From e8d7e1e43259720638a575aaf6485e2efacba0ca Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Wed, 10 Mar 2021 17:00:36 +0200 Subject: [PATCH 1/5] Make activity task usable --- protos/local/core_interface.proto | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/protos/local/core_interface.proto b/protos/local/core_interface.proto index 810e07648..15075aa0e 100644 --- a/protos/local/core_interface.proto +++ b/protos/local/core_interface.proto @@ -7,6 +7,7 @@ package coresdk; // and adding the "api_upstream" subdir as an include path. import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "dependencies/gogoproto/gogo.proto"; import "temporal/api/workflowservice/v1/request_response.proto"; @@ -116,7 +117,29 @@ message SignalWorkflow { } message StartActivity { - // TODO: add attributes + string workflow_namespace = 1; + temporal.api.common.v1.WorkflowType workflow_type = 2; + temporal.api.common.v1.WorkflowExecution workflow_execution = 3; + temporal.api.common.v1.ActivityType activity_type = 4; + temporal.api.common.v1.Header header = 5; + temporal.api.common.v1.Payloads input = 6; + temporal.api.common.v1.Payloads heartbeat_details = 7; + google.protobuf.Timestamp scheduled_time = 8 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp current_attempt_scheduled_time = 9 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp started_time = 10 [(gogoproto.stdtime) = true]; + int32 attempt = 11; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_close_timeout = 12 [(gogoproto.stdduration) = true]; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration start_to_close_timeout = 13 [(gogoproto.stdduration) = true]; + google.protobuf.Duration heartbeat_timeout = 14 [(gogoproto.stdduration) = true]; + // 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. + temporal.api.common.v1.RetryPolicy retry_policy = 15; } message CancelActivity { @@ -124,11 +147,12 @@ message CancelActivity { } message ActivityTask { + string activity_id = 1; oneof job { // Start activity execution. - StartActivity start = 1; + StartActivity start = 2; // Attempt to cancel activity execution. - CancelActivity cancel = 2; + CancelActivity cancel = 3; } } From ba69dadfe80bd071fcaf2fc9f6c14e0294a7e11e Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Thu, 11 Mar 2021 11:23:39 +0200 Subject: [PATCH 2/5] Add ResolveActivity message, remove ActivityTaskCancelation details --- protos/local/core_interface.proto | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/protos/local/core_interface.proto b/protos/local/core_interface.proto index 15075aa0e..10a1b3dfa 100644 --- a/protos/local/core_interface.proto +++ b/protos/local/core_interface.proto @@ -73,6 +73,8 @@ message WFActivationJob { CancelWorkflow cancel_workflow = 6; // A request to signal the workflow was received. SignalWorkflow signal_workflow = 7; + // An activity was resolved with, result could be completed, failed or cancelled + ResolveActivity resolve_activity = 8; } } @@ -95,6 +97,11 @@ message FireTimer { string timer_id = 1; } +message ResolveActivity { + string activity_id = 1; + ActivityResult result = 2; +} + message CancelTimer { string timer_id = 1; } @@ -213,7 +220,6 @@ message WFActivationFailure { } message ActivityTaskCancelation { - temporal.api.common.v1.Payloads details = 1; } message ActivityTaskSuccess { From d922b3bd92c140d1f46b290b59b03519a9d5af99 Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Thu, 11 Mar 2021 11:54:25 +0200 Subject: [PATCH 3/5] Add RequestActivityCancellation and rename query_result to respond_to_query --- protos/local/core_interface.proto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protos/local/core_interface.proto b/protos/local/core_interface.proto index 10a1b3dfa..53aa3f545 100644 --- a/protos/local/core_interface.proto +++ b/protos/local/core_interface.proto @@ -191,9 +191,14 @@ message ActivityResult { } } +message RequestActivityCancellation { + string activity_id = 1; +} + message CoreCommand { oneof variant { - temporal.api.query.v1.WorkflowQueryResult query_result = 1; + temporal.api.query.v1.WorkflowQueryResult respond_to_query = 1; + RequestActivityCancellation request_activity_cancellation = 2; } } From 9a0e9f05635046b7c6c06c1fb9ee59d55a720e12 Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Thu, 11 Mar 2021 14:23:04 +0200 Subject: [PATCH 4/5] Add reason to RequestActivityCancellation --- protos/local/core_interface.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/protos/local/core_interface.proto b/protos/local/core_interface.proto index 53aa3f545..cfd18fef4 100644 --- a/protos/local/core_interface.proto +++ b/protos/local/core_interface.proto @@ -193,6 +193,7 @@ message ActivityResult { message RequestActivityCancellation { string activity_id = 1; + string reason = 2; } message CoreCommand { From ac15c8c271795e39a36fe8d33efda28a05840188 Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Fri, 12 Mar 2021 16:43:58 +0200 Subject: [PATCH 5/5] Document some proto messages --- protos/local/core_interface.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protos/local/core_interface.proto b/protos/local/core_interface.proto index cfd18fef4..0880ad626 100644 --- a/protos/local/core_interface.proto +++ b/protos/local/core_interface.proto @@ -183,6 +183,7 @@ message WFActivationCompletion { } } +/// Used to report activity completion to core and to resolve the activity in a workflow activtion message ActivityResult { oneof status { ActivityTaskSuccess completed = 1; @@ -191,6 +192,7 @@ message ActivityResult { } } +/// Request cancellation of an activity from a workflow message RequestActivityCancellation { string activity_id = 1; string reason = 2; @@ -225,14 +227,17 @@ message WFActivationFailure { // Other bits from RespondWorkflowTaskFailedRequest as needed } +/// Used in ActivityResult to report cancellation message ActivityTaskCancelation { } +/// Used in ActivityResult to report successful completion message ActivityTaskSuccess { temporal.api.common.v1.Payloads result = 1; // Other bits from RespondActivityTaskCompletedRequest as needed } +/// Used in ActivityResult to report failure message ActivityTaskFailure { temporal.api.failure.v1.Failure failure = 1; // Other bits from RespondActivityTaskFailedRequest as needed