I am using python and google.cloud.tasks_v2. After deploying my service in app engine I create task and it creates and executing successfully, but how I can get the task status or the result of task execution if method client.get_task() do not return any information about that?
For getting information about a specified Cloud Task that you are running, you can use the command line and integrate it into your Python's code using a package like subprocess
to run the following command:
gcloud tasks describe TASK [--queue=QUEUE]
Moreover, if you would like to see the status of a task attempt you can use the following for the Cloud Task API.
It will give you information about the status of a task attempt with the following JSON representation:
{
"scheduleTime": string,
"dispatchTime": string,
"responseTime": string,
"responseStatus": {
object (Status)
}
}
To see the status of the task's first attempt firstAttempt
or the status of the task's last attempt lastAttempt
you can use the following method within the Cloud Task API.
As stated here, please bear in mind that if you are using App Engine tasks within a Cloud Tasks queue, the code status will be as follow:
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.