Skip to content
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

feat: [tasks] increase timeout of RPC methods to 20s for v2 #4425

Merged
merged 2 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
114 changes: 58 additions & 56 deletions packages/google-cloud-tasks/README.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

Expand Down Expand Up @@ -152,7 +151,7 @@ message Queue {

// Output only. The state of the queue.
//
// `state` can only be changed by called
// `state` can only be changed by calling
// [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue],
// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue], or uploading
// [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref).
Expand Down Expand Up @@ -336,7 +335,7 @@ message RetryConfig {
// A task's retry interval starts at
// [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff], then doubles
// `max_doublings` times, then increases linearly, and finally
// retries retries at intervals of
// retries at intervals of
// [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] up to
// [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

Expand Down Expand Up @@ -166,9 +165,10 @@ message HttpRequest {
// or task-level:
//
// * If [app_engine_routing_override is set on the
// queue][Queue.app_engine_routing_override], this value is used for all
// tasks in the queue, no matter what the setting is for the [task-level
// app_engine_routing][AppEngineHttpRequest.app_engine_routing].
// queue][google.cloud.tasks.v2.Queue.app_engine_routing_override], this value
// is used for all tasks in the queue, no matter what the setting is for the
// [task-level
// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
//
//
// The `url` that the task will be sent to is:
Expand Down Expand Up @@ -202,22 +202,20 @@ message AppEngineHttpRequest {
// The HTTP method to use for the request. The default is POST.
//
// The app's request handler for the task's target URL must be able to handle
// HTTP requests with this http_method, otherwise the task attempt will fail
// with error code 405 (Method Not Allowed). See
// [Writing a push task request
// HTTP requests with this http_method, otherwise the task attempt fails with
// error code 405 (Method Not Allowed). See [Writing a push task request
// handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
// and the documentation for the request handlers in the language your app is
// written in e.g.
// [Python Request
// Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
// and the App Engine documentation for your runtime on [How Requests are
// Handled](https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled).
HttpMethod http_method = 1;

// Task-level setting for App Engine routing.
//
// * If [app_engine_routing_override is set on the
// queue][Queue.app_engine_routing_override], this value is used for all
// tasks in the queue, no matter what the setting is for the [task-level
// app_engine_routing][AppEngineHttpRequest.app_engine_routing].
// queue][google.cloud.tasks.v2.Queue.app_engine_routing_override], this
// value is used for all tasks in the queue, no matter what the setting is
// for the [task-level
// app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing].
AppEngineRouting app_engine_routing = 2;

// The relative URI.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

Expand Down Expand Up @@ -118,8 +117,8 @@ message Task {
// is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the
// task according to the [RetryConfig][google.cloud.tasks.v2.RetryConfig].
//
// Note that when the request is cancelled, Cloud Tasks will stop listing for
// the response, but whether the worker stops processing depends on the
// Note that when the request is cancelled, Cloud Tasks will stop listening
// for the response, but whether the worker stops processing depends on the
// worker. For example, if the worker is stuck, it may not react to cancelled
// requests.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@ package google.cloud.tasks.v2beta2;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/httpbody.proto";
import "google/api/resource.proto";
import "google/cloud/tasks/v2beta2/queue.proto";
import "google/cloud/tasks/v2beta2/task.proto";
Expand All @@ -34,6 +35,10 @@ option java_multiple_files = true;
option java_outer_classname = "CloudTasksProto";
option java_package = "com.google.cloud.tasks.v2beta2";
option objc_class_prefix = "TASKS";
option (google.api.resource_definition) = {
type: "cloudtasks.googleapis.com/Location"
pattern: "projects/{project}/locations/{location}"
};

// Cloud Tasks allows developers to manage the execution of background
// work in their applications.
Expand Down Expand Up @@ -176,6 +181,13 @@ service CloudTasks {
option (google.api.method_signature) = "name";
}

// Update queue list by uploading a queue.yaml file.
//
// The queue.yaml file is supplied in the request body as a YAML encoded
// string. This method was added to support gcloud clients versions before
// 322.0.0. New clients should use CreateQueue instead of this method.
rpc UploadQueueYaml(UploadQueueYamlRequest) returns (google.protobuf.Empty) {}

// Gets the access control policy for a
// [Queue][google.cloud.tasks.v2beta2.Queue]. Returns an empty policy if the
// resource exists and does not have a policy set.
Expand Down Expand Up @@ -402,6 +414,25 @@ service CloudTasks {
};
option (google.api.method_signature) = "name";
}

// Creates and buffers a new task without the need to explicitly define a Task
// message. The queue must have [HTTP
// target][google.cloud.tasks.v2beta2.HttpTarget]. To create the task with a
// custom ID, use the following format and set TASK_ID to your desired ID:
// projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer
// To create the task with an automatically generated ID, use the following
// format:
// projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.
// Note: This feature is in its experimental stage. You must request access to
// the API through the [Cloud Tasks BufferTask Experiment Signup
// form](https://forms.gle/X8Zr5hiXH5tTGFqh8).
rpc BufferTask(BufferTaskRequest) returns (BufferTaskResponse) {
option (google.api.http) = {
post: "/v2beta2/{queue=projects/*/locations/*/queues/*}/tasks/{task_id}:buffer"
body: "*"
};
option (google.api.method_signature) = "queue,task_id,body";
}
}

// Request message for
Expand Down Expand Up @@ -591,6 +622,18 @@ message ResumeQueueRequest {
];
}

// Request message for
// [UploadQueueYaml][google.cloud.tasks.v2beta2.CloudTasks.UploadQueueYaml].
message UploadQueueYamlRequest {
// Required. The App ID is supplied as an HTTP parameter. Unlike internal
// usage of App ID, it does not include a region prefix. Rather, the App ID
// represents the Project ID against which to make the request.
string app_id = 1 [(google.api.field_behavior) = REQUIRED];

// The http body contains the queue.yaml file which used to update queue lists
optional google.api.HttpBody http_body = 2;
}

// Request message for listing tasks using
// [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks].
message ListTasksRequest {
Expand Down Expand Up @@ -716,10 +759,10 @@ message CreateTaskRequest {
// that was deleted or completed recently then the call will fail
// with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
// If the task's queue was created using Cloud Tasks, then another task with
// the same name can't be created for ~1hour after the original task was
// the same name can't be created for ~1 hour after the original task was
// deleted or completed. If the task's queue was created using queue.yaml or
// queue.xml, then another task with the same name can't be created
// for ~9days after the original task was deleted or completed.
// for ~9 days after the original task was deleted or completed.
//
// Because there is an extra lookup cost to identify duplicate task
// names, these [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
Expand Down Expand Up @@ -985,3 +1028,36 @@ message RunTaskRequest {
// [Task][google.cloud.tasks.v2beta2.Task] resource.
Task.View response_view = 2;
}

// LINT.IfChange
// Request message for
// [BufferTask][google.cloud.tasks.v2beta2.CloudTasks.BufferTask].
message BufferTaskRequest {
// Required. The parent queue name. For example:
// projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
//
// The queue must already exist.
string queue = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "cloudtasks.googleapis.com/Task"
}
];

// Optional. Task ID for the task being created. If not provided, a random
// task ID is assigned to the task.
string task_id = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Body of the HTTP request.
//
// The body can take any generic value. The value is written to the
// [HttpRequest][payload] of the [Task].
google.api.HttpBody body = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [BufferTask][google.cloud.tasks.v2beta2.CloudTasks.BufferTask].
message BufferTaskResponse {
// The created task.
Task task = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.tasks.v2beta2;

option go_package = "cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb;cloudtaskspb";
option java_multiple_files = true;
option java_outer_classname = "OldTargetProto";
option java_package = "com.google.cloud.tasks.v2beta2";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -119,6 +119,9 @@ message Queue {
// A pull queue is a queue that has a
// [PullTarget][google.cloud.tasks.v2beta2.PullTarget].
PullTarget pull_target = 4;

// An http_target is used to override the target values for HTTP tasks.
HttpTarget http_target = 17;
}

// Rate limits for task dispatches.
Expand Down Expand Up @@ -154,7 +157,7 @@ message Queue {

// Output only. The state of the queue.
//
// `state` can only be changed by calling
// `state` can only be changed by called
// [PauseQueue][google.cloud.tasks.v2beta2.CloudTasks.PauseQueue],
// [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue], or
// uploading
Expand Down
Loading