Skip to content

Commit 284a06c

Browse files
committed
Proto updates again
1 parent fe67144 commit 284a06c

7 files changed

Lines changed: 38 additions & 56 deletions

File tree

core/src/pollers/poll_buffer.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ use temporal_sdk_core_api::worker::{
2020
ActivitySlotKind, NexusSlotKind, PollerBehavior, SlotKind, WorkflowSlotKind,
2121
};
2222
use temporal_sdk_core_protos::temporal::api::{
23-
sdk::v1::PollerScalingDecision,
24-
taskqueue::v1::TaskQueue,
23+
taskqueue::v1::{PollerScalingDecision, TaskQueue},
2524
workflowservice::v1::{
2625
PollActivityTaskQueueResponse, PollNexusTaskQueueResponse, PollWorkflowTaskQueueResponse,
2726
},
@@ -298,14 +297,16 @@ impl PollScalerReportHandle {
298297
return;
299298
}
300299
if let Some(scaling_decision) = res.scaling_decision() {
301-
match scaling_decision.poller_delta.cmp(&0) {
300+
match scaling_decision.poll_request_delta_suggestion.cmp(&0) {
302301
cmp::Ordering::Less => self.change_target(
303302
usize::saturating_sub,
304-
scaling_decision.poller_delta.unsigned_abs() as usize,
303+
scaling_decision
304+
.poll_request_delta_suggestion
305+
.unsigned_abs() as usize,
305306
),
306307
cmp::Ordering::Greater => self.change_target(
307308
usize::saturating_add,
308-
scaling_decision.poller_delta as usize,
309+
scaling_decision.poll_request_delta_suggestion as usize,
309310
),
310311
cmp::Ordering::Equal => {}
311312
}

sdk-core-protos/protos/api_upstream/openapi/openapiv2.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11432,12 +11432,13 @@
1143211432
"v1PollerScalingDecision": {
1143311433
"type": "object",
1143411434
"properties": {
11435-
"pollerDelta": {
11435+
"pollRequestDeltaSuggestion": {
1143611436
"type": "integer",
1143711437
"format": "int32",
11438-
"description": "How many pollers should be added or removed, if any. As of now, server only scales up or down\nby 1. However, SDKs should allow for other values (while staying within defined min/max)."
11438+
"description": "How many poll requests to suggest should be added or removed, if any. As of now, server only\nscales up or down by 1. However, SDKs should allow for other values (while staying within\ndefined min/max).\n\nThe SDK is free to ignore this suggestion, EX: making more polls would not make sense because\nall slots are already occupied."
1143911439
}
11440-
}
11440+
},
11441+
"description": "Attached to task responses to give hints to the SDK about how it may adjust its number of\npollers."
1144111442
},
1144211443
"v1ProtocolMessageCommandAttributes": {
1144311444
"type": "object",

sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8595,12 +8595,19 @@ components:
85958595
PollerScalingDecision:
85968596
type: object
85978597
properties:
8598-
pollerDelta:
8598+
pollRequestDeltaSuggestion:
85998599
type: integer
86008600
description: |-
8601-
How many pollers should be added or removed, if any. As of now, server only scales up or down
8602-
by 1. However, SDKs should allow for other values (while staying within defined min/max).
8601+
How many poll requests to suggest should be added or removed, if any. As of now, server only
8602+
scales up or down by 1. However, SDKs should allow for other values (while staying within
8603+
defined min/max).
8604+
8605+
The SDK is free to ignore this suggestion, EX: making more polls would not make sense because
8606+
all slots are already occupied.
86038607
format: int32
8608+
description: |-
8609+
Attached to task responses to give hints to the SDK about how it may adjust its number of
8610+
pollers.
86048611
QueryRejected:
86058612
type: object
86068613
properties:

sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/poller_scaling.proto

Lines changed: 0 additions & 38 deletions
This file was deleted.

sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,16 @@ message TimestampedBuildIdAssignmentRule {
323323
message TimestampedCompatibleBuildIdRedirectRule {
324324
CompatibleBuildIdRedirectRule rule = 1;
325325
google.protobuf.Timestamp create_time = 2;
326-
}
326+
}
327+
328+
// Attached to task responses to give hints to the SDK about how it may adjust its number of
329+
// pollers.
330+
message PollerScalingDecision {
331+
// How many poll requests to suggest should be added or removed, if any. As of now, server only
332+
// scales up or down by 1. However, SDKs should allow for other values (while staying within
333+
// defined min/max).
334+
//
335+
// The SDK is free to ignore this suggestion, EX: making more polls would not make sense because
336+
// all slots are already occupied.
337+
int32 poll_request_delta_suggestion = 1;
338+
}

sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import "temporal/api/taskqueue/v1/message.proto";
5858
import "temporal/api/update/v1/message.proto";
5959
import "temporal/api/version/v1/message.proto";
6060
import "temporal/api/batch/v1/message.proto";
61-
import "temporal/api/sdk/v1/poller_scaling.proto";
6261
import "temporal/api/sdk/v1/task_complete_metadata.proto";
6362
import "temporal/api/sdk/v1/user_metadata.proto";
6463
import "temporal/api/nexus/v1/message.proto";
@@ -333,7 +332,7 @@ message PollWorkflowTaskQueueResponse {
333332
// Protocol messages piggybacking on a WFT as a transport
334333
repeated temporal.api.protocol.v1.Message messages = 15;
335334
// Server-advised information the SDK may use to adjust its poller count.
336-
temporal.api.sdk.v1.PollerScalingDecision poller_scaling_decision = 16;
335+
temporal.api.taskqueue.v1.PollerScalingDecision poller_scaling_decision = 16;
337336
}
338337

339338
message RespondWorkflowTaskCompletedRequest {
@@ -500,7 +499,7 @@ message PollActivityTaskQueueResponse {
500499
// values are not specified or exceed configured system limits.
501500
temporal.api.common.v1.RetryPolicy retry_policy = 17;
502501
// Server-advised information the SDK may use to adjust its poller count.
503-
temporal.api.sdk.v1.PollerScalingDecision poller_scaling_decision = 18;
502+
temporal.api.taskqueue.v1.PollerScalingDecision poller_scaling_decision = 18;
504503
}
505504

506505
message RecordActivityTaskHeartbeatRequest {
@@ -1739,7 +1738,7 @@ message PollNexusTaskQueueResponse {
17391738
// Embedded request as translated from the incoming frontend request.
17401739
temporal.api.nexus.v1.Request request = 2;
17411740
// Server-advised information the SDK may use to adjust its poller count.
1742-
temporal.api.sdk.v1.PollerScalingDecision poller_scaling_decision = 3;
1741+
temporal.api.taskqueue.v1.PollerScalingDecision poller_scaling_decision = 3;
17431742
}
17441743

17451744
message RespondNexusTaskCompletedRequest {
@@ -2113,7 +2112,7 @@ message ListWorkerDeploymentsResponse {
21132112
bytes next_page_token = 1;
21142113
// The list of worker deployments.
21152114
repeated WorkerDeploymentSummary worker_deployments = 2;
2116-
2115+
21172116
// (-- api-linter: core::0123::resource-annotation=disabled --)
21182117
// A subset of WorkerDeploymentInfo
21192118
message WorkerDeploymentSummary {

tests/manual_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use tracing::info;
2424
#[tokio::test]
2525
async fn poller_load_spiky() {
2626
const SIGNAME: &str = "signame";
27-
let num_workflows = 250;
27+
let num_workflows = 1000;
2828
let wf_name = "poller_load";
2929
let (telemopts, addr, _aborter) =
3030
if std::env::var("PAR_JOBNUM").unwrap_or("1".to_string()) == "1" {

0 commit comments

Comments
 (0)