Class: Google::Apis::CloudtasksV2::Task
- Inherits:
-
Object
- Object
- Google::Apis::CloudtasksV2::Task
- Defined in:
- generated/google/apis/cloudtasks_v2/classes.rb,
generated/google/apis/cloudtasks_v2/representations.rb,
generated/google/apis/cloudtasks_v2/representations.rb
Overview
A unit of scheduled work.
Instance Attribute Summary collapse
-
#app_engine_http_request ⇒ Google::Apis::CloudtasksV2::AppEngineHttpRequest
App Engine HTTP request.
-
#create_time ⇒ String
Output only.
-
#dispatch_count ⇒ Fixnum
Output only.
-
#dispatch_deadline ⇒ String
The deadline for requests sent to the worker.
-
#first_attempt ⇒ Google::Apis::CloudtasksV2::Attempt
The status of a task attempt.
-
#http_request ⇒ Google::Apis::CloudtasksV2::HttpRequest
HTTP request.
-
#last_attempt ⇒ Google::Apis::CloudtasksV2::Attempt
The status of a task attempt.
-
#name ⇒ String
Optionally caller-specified in CreateTask.
-
#response_count ⇒ Fixnum
Output only.
-
#schedule_time ⇒ String
The time when the task is scheduled to be attempted or retried.
-
#view ⇒ String
Output only.
Instance Method Summary collapse
-
#initialize(**args) ⇒ Task
constructor
A new instance of Task.
-
#update!(**args) ⇒ Object
Update properties of this object.
Methods included from Google::Apis::Core::JsonObjectSupport
Methods included from Google::Apis::Core::Hashable
Constructor Details
#initialize(**args) ⇒ Task
Returns a new instance of Task.
1664 1665 1666 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1664 def initialize(**args) update!(**args) end |
Instance Attribute Details
#app_engine_http_request ⇒ Google::Apis::CloudtasksV2::AppEngineHttpRequest
App Engine HTTP request.
The message defines the HTTP request that is sent to an App Engine app when
the task is dispatched.
Using AppEngineHttpRequest requires
appengine.applications.get
Google IAM permission for the project
and the following scope:
https://www.googleapis.com/auth/cloud-platform
The task will be delivered to the App Engine app which belongs to the same
project as the queue. For more information, see
How Requests are
Routed
and how routing is affected by
dispatch
files.
Traffic is encrypted during transport and never leaves Google datacenters.
Because this traffic is carried over a communication mechanism internal to
Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS).
The request to the handler, however, will appear to have used the HTTP
protocol.
The AppEngineRouting used to construct the URL that the task is
delivered to can be set at the queue-level or task-level:
- If app_engine_routing_override is set on the
queue, this value is used for all
tasks in the queue, no matter what the setting is for the task-level
app_engine_routing.
The
url
that the task will be sent to is: url =
host+
relative_uri Tasks can be dispatched to secure app handlers, unsecure app handlers, and URIs restricted withlogin: admin
. Because tasks are not run as any user, they cannot be dispatched to URIs restricted withlogin: required
Task dispatches also do not follow redirects. The task attempt has succeeded if the app's request handler returns an HTTP response code in the range [200
-299
]. The task attempt has failed if the app's handler returns a non-2xx response code or Cloud Tasks does not receive response before the deadline. Failed tasks will be retried according to the retry configuration.503
(Service Unavailable) is considered an App Engine system error instead of an application error and will cause Cloud Tasks' traffic congestion control to temporarily throttle the queue's dispatches. Unlike other types of task targets, a429
(Too Many Requests) response from an app handler does not cause traffic congestion control to throttle the queue. Corresponds to the JSON propertyappEngineHttpRequest
1542 1543 1544 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1542 def app_engine_http_request @app_engine_http_request end |
#create_time ⇒ String
Output only. The time that the task was created.
create_time
will be truncated to the nearest second.
Corresponds to the JSON property createTime
1548 1549 1550 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1548 def create_time @create_time end |
#dispatch_count ⇒ Fixnum
Output only. The number of attempts dispatched.
This count includes attempts which have been dispatched but haven't
received a response.
Corresponds to the JSON property dispatchCount
1555 1556 1557 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1555 def dispatch_count @dispatch_count end |
#dispatch_deadline ⇒ String
The deadline for requests sent to the worker. If the worker does not
respond by this deadline then the request is cancelled and the attempt
is marked as a DEADLINE_EXCEEDED
failure. Cloud Tasks will retry the
task according to the 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
worker. For example, if the worker is stuck, it may not react to cancelled
requests.
The default and maximum values depend on the type of request:
- For HTTP tasks, the default is 10 minutes. The deadline must be in the interval [15 seconds, 30 minutes].
- For App Engine tasks, 0 indicates that the
request has the default deadline. The default deadline depends on the
scaling
type
of the service: 10 minutes for standard apps with automatic scaling, 24
hours for standard apps with manual and basic scaling, and 60 minutes for
flex apps. If the request deadline is set, it must be in the interval [15
seconds, 24 hours 15 seconds]. Regardless of the task's
dispatch_deadline
, the app handler will not run for longer than than the service's timeout. We recommend setting thedispatch_deadline
to at most a few seconds more than the app handler's timeout. For more information see Timeouts.dispatch_deadline
will be truncated to the nearest millisecond. The deadline is an approximate deadline. Corresponds to the JSON propertydispatchDeadline
1587 1588 1589 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1587 def dispatch_deadline @dispatch_deadline end |
#first_attempt ⇒ Google::Apis::CloudtasksV2::Attempt
The status of a task attempt.
Corresponds to the JSON property firstAttempt
1592 1593 1594 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1592 def first_attempt @first_attempt end |
#http_request ⇒ Google::Apis::CloudtasksV2::HttpRequest
HTTP request.
The task will be pushed to the worker as an HTTP request. If the worker
or the redirected worker acknowledges the task by returning a successful HTTP
response code ([200
- 299
]), the task will be removed from the queue. If
any other HTTP response code is returned or no response is received, the
task will be retried according to the following:
- User-specified throttling: retry configuration, rate limits, and the queue's state.
- System throttling: To prevent the worker from overloading, Cloud Tasks may temporarily reduce the queue's effective rate. User-specified settings will not be changed. System throttling happens because:
- Cloud Tasks backs off on all errors. Normally the backoff specified in
rate limits will be used. But if the worker returns
429
(Too Many Requests),503
(Service Unavailable), or the rate of errors is high, Cloud Tasks will use a higher backoff rate. The retry specified in theRetry-After
HTTP response header is considered. - To prevent traffic spikes and to smooth sudden increases in traffic,
dispatches ramp up slowly when the queue is newly created or idle and
if large numbers of tasks suddenly become available to dispatch (due to
spikes in create task rates, the queue being unpaused, or many tasks
that are scheduled at the same time).
Corresponds to the JSON property
httpRequest
1618 1619 1620 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1618 def http_request @http_request end |
#last_attempt ⇒ Google::Apis::CloudtasksV2::Attempt
The status of a task attempt.
Corresponds to the JSON property lastAttempt
1623 1624 1625 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1623 def last_attempt @last_attempt end |
#name ⇒ String
Optionally caller-specified in CreateTask.
The task name.
The task name must have the following format:
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID
PROJECT_ID
can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see Identifying projectsLOCATION_ID
is the canonical ID for the task's location. The list of available locations can be obtained by calling ListLocations. For more information, see https://cloud.google.com/about/locations/.QUEUE_ID
can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters.TASK_ID
can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The maximum length is 500 characters. Corresponds to the JSON propertyname
1645 1646 1647 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1645 def name @name end |
#response_count ⇒ Fixnum
Output only. The number of attempts which have received a response.
Corresponds to the JSON property responseCount
1650 1651 1652 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1650 def response_count @response_count end |
#schedule_time ⇒ String
The time when the task is scheduled to be attempted or retried.
schedule_time
will be truncated to the nearest microsecond.
Corresponds to the JSON property scheduleTime
1656 1657 1658 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1656 def schedule_time @schedule_time end |
#view ⇒ String
Output only. The view specifies which subset of the Task has
been returned.
Corresponds to the JSON property view
1662 1663 1664 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1662 def view @view end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 |
# File 'generated/google/apis/cloudtasks_v2/classes.rb', line 1669 def update!(**args) @app_engine_http_request = args[:app_engine_http_request] if args.key?(:app_engine_http_request) @create_time = args[:create_time] if args.key?(:create_time) @dispatch_count = args[:dispatch_count] if args.key?(:dispatch_count) @dispatch_deadline = args[:dispatch_deadline] if args.key?(:dispatch_deadline) @first_attempt = args[:first_attempt] if args.key?(:first_attempt) @http_request = args[:http_request] if args.key?(:http_request) @last_attempt = args[:last_attempt] if args.key?(:last_attempt) @name = args[:name] if args.key?(:name) @response_count = args[:response_count] if args.key?(:response_count) @schedule_time = args[:schedule_time] if args.key?(:schedule_time) @view = args[:view] if args.key?(:view) end |