Method: projects.locations.queues.tasks.run

Forces a task to run now.

When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its RateLimits or is PAUSED.

This command is meant to be used for manual debugging. For example, tasks.run can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.

The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target.

If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's scheduleTime will be reset to the time that tasks.run was called plus the retry delay specified in the queue's RetryConfig.

tasks.run returns google.rpc.Code.NOT_FOUND when it is called on a task that has already succeeded or permanently failed.

HTTP request

POST https://cloudtasks.googleapis.com/v2/{name=projects/*/locations/*/queues/*/tasks/*}:run

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Authorization requires the following IAM permission on the specified resource name:

  • cloudtasks.tasks.run

Request body

The request body contains data with the following structure:

JSON representation
{
  "responseView": enum (View)
}
Fields
responseView

enum (View)

The responseView specifies which subset of the Task will be returned.

By default responseView is BASIC; not all information is retrieved by default because some data, such as payloads, might be desirable to return only when needed because of its large size or because of the sensitivity of data that it contains.

Authorization for FULL requires cloudtasks.tasks.fullView Google IAM permission on the Task resource.

Response body

If successful, the response body contains an instance of Task.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-tasks

For more information, see the Authentication Overview.