Skip to content

Commit

Permalink
feat: introducing field: ListQueuesRequest.read_mask, GetQueueRequest…
Browse files Browse the repository at this point in the history
….read_mask, Queue.task_ttl, Queue.tombstone_ttl, Queue.stats, Task.pull_message and introducing messages: QueueStats PullMessage

docs: updates to max burst size description

PiperOrigin-RevId: 353032056
  • Loading branch information
Google APIs authored and Copybara-Service committed Jan 21, 2021
1 parent d7b8108 commit a0b91c3
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 15 deletions.
12 changes: 12 additions & 0 deletions google/cloud/tasks/v2beta3/cloudtasks.proto
Expand Up @@ -345,6 +345,12 @@ message ListQueuesRequest {
// method. It is an error to switch the value of the
// [filter][google.cloud.tasks.v2beta3.ListQueuesRequest.filter] while iterating through pages.
string page_token = 4;

// Optional. Read mask is used for a more granular control over what the API returns.
// If the mask is not present all fields will be returned except
// [Queue.stats]. [Queue.stats] will be returned only if it was explicitly
// specified in the mask.
google.protobuf.FieldMask read_mask = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for [ListQueues][google.cloud.tasks.v2beta3.CloudTasks.ListQueues].
Expand Down Expand Up @@ -374,6 +380,12 @@ message GetQueueRequest {
type: "cloudtasks.googleapis.com/Queue"
}
];

// Optional. Read mask is used for a more granular control over what the API returns.
// If the mask is not present all fields will be returned except
// [Queue.stats]. [Queue.stats] will be returned only if it was explicitly
// specified in the mask.
google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for [CreateQueue][google.cloud.tasks.v2beta3.CloudTasks.CreateQueue].
Expand Down
Expand Up @@ -35,7 +35,7 @@
"method": "RunTask"
}
],
"timeout": "10s"
"timeout": "20s"
},
{
"name": [
Expand Down Expand Up @@ -72,7 +72,7 @@
"method": "DeleteTask"
}
],
"timeout": "10s",
"timeout": "20s",
"retryPolicy": {
"initialBackoff": "0.100s",
"maxBackoff": "10s",
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/tasks/v2beta3/cloudtasks_v2beta3.yaml
Expand Up @@ -17,8 +17,6 @@ documentation:
backend:
rules:
- selector: 'google.cloud.tasks.v2beta3.CloudTasks.*'
deadline: 10.0
- selector: google.cloud.tasks.v2beta3.CloudTasks.ListQueues
deadline: 15.0

authentication:
Expand Down
81 changes: 70 additions & 11 deletions google/cloud/tasks/v2beta3/queue.proto
Expand Up @@ -174,6 +174,32 @@ message Queue {
// time will be unset if the queue has never been purged.
google.protobuf.Timestamp purge_time = 7;

// The maximum amount of time that a task will be retained in
// this queue.
//
// Queues created by Cloud Tasks have a default `task_ttl` of 31 days.
// After a task has lived for `task_ttl`, the task will be deleted
// regardless of whether it was dispatched or not.
//
// The `task_ttl` for queues created via queue.yaml/xml is equal to the
// maximum duration because there is a
// [storage quota](https://cloud.google.com/appengine/quotas#Task_Queue) for
// these queues. To view the maximum valid duration, see the documentation for
// [Duration][google.protobuf.Duration].
google.protobuf.Duration task_ttl = 8;

// The task tombstone time to live (TTL).
//
// After a task is deleted or executed, the task's tombstone is
// retained for the length of time specified by `tombstone_ttl`.
// The tombstone is used by task de-duplication; another task with the same
// name can't be created until the tombstone has expired. For more information
// about task de-duplication, see the documentation for
// [CreateTaskRequest][google.cloud.tasks.v2beta3.CreateTaskRequest.task].
//
// Queues created by Cloud Tasks have a default `tombstone_ttl` of 1 hour.
google.protobuf.Duration tombstone_ttl = 9;

// Configuration options for writing logs to
// [Stackdriver Logging](https://cloud.google.com/logging/docs/). If this
// field is unset, then no logs are written.
Expand All @@ -185,6 +211,11 @@ message Queue {
// creation time. When left unspecified, the default value of `PUSH` is
// selected.
Type type = 11 [(google.api.field_behavior) = IMMUTABLE];

// Output only. The realtime, informational statistics for a queue. In order
// to receive the statistics the caller should include this field in the
// FieldMask.
QueueStats stats = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Rate limits.
Expand All @@ -209,7 +240,7 @@ message RateLimits {
// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate).
double max_dispatches_per_second = 1;

// Output only. The max burst size.
// The max burst size.
//
// Max burst size limits how fast tasks in queue are processed when
// many tasks are in the queue and the rate is high. This field
Expand All @@ -226,21 +257,21 @@ message RateLimits {
// continuously refilled with new tokens based on
// [max_dispatches_per_second][google.cloud.tasks.v2beta3.RateLimits.max_dispatches_per_second].
//
// Cloud Tasks will pick the value of `max_burst_size` based on the
// value of
// The default value of `max_burst_size` is picked by Cloud Tasks
// based on the value of
// [max_dispatches_per_second][google.cloud.tasks.v2beta3.RateLimits.max_dispatches_per_second].
//
// The maximum value of `max_burst_size` is 500.
//
// For App Engine queues that were created or updated using
// `queue.yaml/xml`, `max_burst_size` is equal to
// [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size).
// Since `max_burst_size` is output only, if
// [UpdateQueue][google.cloud.tasks.v2beta3.CloudTasks.UpdateQueue] is called on a queue
// created by `queue.yaml/xml`, `max_burst_size` will be reset based
// on the value of
// [max_dispatches_per_second][google.cloud.tasks.v2beta3.RateLimits.max_dispatches_per_second],
// regardless of whether
// [max_dispatches_per_second][google.cloud.tasks.v2beta3.RateLimits.max_dispatches_per_second]
// is updated.
// If
// [UpdateQueue][google.cloud.tasks.v2beta3.CloudTasks.UpdateQueue] is called on a queue without
// explicitly setting a value for `max_burst_size`,
// `max_burst_size` value will get updated if
// [UpdateQueue][google.cloud.tasks.v2beta3.CloudTasks.UpdateQueue] is updating
// [max_dispatches_per_second][google.cloud.tasks.v2beta3.RateLimits.max_dispatches_per_second].
//
int32 max_burst_size = 2;

Expand Down Expand Up @@ -374,3 +405,31 @@ message StackdriverLoggingConfig {
// 0.0 is the default and means that no operations are logged.
double sampling_ratio = 1;
}

// Statistics for a queue.
message QueueStats {
// Output only. An estimation of the number of tasks in the queue, that is, the tasks in
// the queue that haven't been executed, the tasks in the queue which the
// queue has dispatched but has not yet received a reply for, and the failed
// tasks that the queue is retrying.
int64 tasks_count = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. An estimation of the nearest time in the future where a task in the queue
// is scheduled to be executed.
google.protobuf.Timestamp oldest_estimated_arrival_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The number of tasks that the queue has dispatched and received a reply for
// during the last minute. This variable counts both successful and
// non-successful executions.
int64 executed_last_minute_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The number of requests that the queue has dispatched but has not received
// a reply for yet.
int64 concurrent_dispatches_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The current maximum number of tasks per second executed by the queue.
// The maximum value of this variable is controlled by the RateLimits of the
// Queue. However, this value could be less to avoid overloading the endpoints
// tasks in the queue are targeting.
double effective_execution_rate = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}
24 changes: 24 additions & 0 deletions google/cloud/tasks/v2beta3/target.proto
Expand Up @@ -23,6 +23,30 @@ option java_multiple_files = true;
option java_outer_classname = "TargetProto";
option java_package = "com.google.cloud.tasks.v2beta3";

// Pull Message.
//
// This proto can only be used for tasks in a queue which has
// [PULL][google.cloud.tasks.v2beta3.Queue.type] type. It currently exists for backwards compatibility with
// the App Engine Task Queue SDK. This message type maybe returned with methods
// [list][google.cloud.tasks.v2beta3.CloudTask.ListTasks] and
// [get][google.cloud.tasks.v2beta3.CloudTask.ListTasks], when the response view
// is [FULL][google.cloud.tasks.v2beta3.Task.View.Full].
message PullMessage {
// A data payload consumed by the worker to execute the task.
bytes payload = 1;

// The tasks's tag.
//
// The tag is less than 500 characters.
//
// SDK compatibility: Although the SDK allows tags to be either
// string or
// [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
// only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8
// encoded, the tag will be empty when the task is returned by Cloud Tasks.
string tag = 2;
}

// HTTP request.
//
// The task will be pushed to the worker as an HTTP request. If the worker
Expand Down
9 changes: 9 additions & 0 deletions google/cloud/tasks/v2beta3/task.proto
Expand Up @@ -97,6 +97,15 @@ message Task {
//
// An HTTP task is a task that has [HttpRequest][google.cloud.tasks.v2beta3.HttpRequest] set.
HttpRequest http_request = 11;

// Pull Message contained in a task in a [PULL][google.cloud.tasks.v2beta3.Queue.type] queue type. This
// payload type cannot be explicitly set through Cloud Tasks API. Its
// purpose, currently is to provide backward compatibility with App Engine
// Task Queue
// [pull](https://cloud.google.com/appengine/docs/standard/java/taskqueue/pull/)
// queues to provide a way to inspect contents of pull tasks through the
// [CloudTasks.GetTask][google.cloud.tasks.v2beta3.CloudTasks.GetTask].
PullMessage pull_message = 13;
}

// The time when the task is scheduled to be attempted.
Expand Down

0 comments on commit a0b91c3

Please sign in to comment.