简体   繁体   English

有没有办法获得谷歌云任务状态?

[英]Is there any way to get google cloud task status?

I am using python and google.cloud.tasks_v2.我正在使用 python 和 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?在应用程序引擎中部署我的服务后,我创建了任务并成功创建并执行,但是如果方法 client.get_task() 不返回任何相关信息,我如何获取任务状态或任务执行结果?

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:要获取有关您正在运行的指定 Cloud Task 的信息,您可以使用命令行并使用subprocess类的包将其集成到 Python 代码中,以运行以下命令:

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.此外,如果您想查看任务尝试的状态,您可以将以下内容用于Cloud Task API。

It will give you information about the status of a task attempt with the following JSON representation:它将使用以下 JSON 表示为您提供有关任务尝试状态的信息:

{
  "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.要查看任务第一次尝试firstAttempt的状态或任务最后一次尝试lastAttempt的状态,您可以在 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:如此处所述请记住,如果您在 Cloud Tasks 队列中使用 App Engine 任务,代码状态将如下所示:

The task attempt has succeeded if the app's request handler returns an HTTP response code in the range [200 - 299].如果应用程序的请求处理程序返回 [200 - 299] 范围内的 HTTP 响应代码,则任务尝试成功。 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.如果应用程序的处理程序返回非 2xx 响应代码或 Cloud Tasks 在截止日期前未收到响应,则任务尝试失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在ML Engine作业中从培训师那里获取状态(Google Cloud Platform) - Get status from trainer in ML Engine job (Google Cloud Platform) Python Celery 获取任务状态 - Python Celery get task status 有没有办法使用 python 获取谷歌云存储桶中的对象数量? - Is there a way to get number of objects in a google cloud storage bucket using python? 有没有办法在 Google Cloud Datastore 中执行阻塞 get() 调用? - Is there a way to execute a blocking get() call in Google Cloud Datastore? 使用api python客户端获取Google云容器集群置备的状态 - Get the status of google cloud container cluster provisioning using api python client 在 Google App Engine 中检查任务队列的状态 - Checking status of Task Queue in Google App Engine 从Google云端存储获取状态503 - getting status 503 from google cloud storage Python,有没有办法登录谷歌云身份,然后通过 SAML 连接到 Azure AD? - Python, Is there any way to login to google cloud identity that then connects through SAML to Azure AD? Google Cloud Storage + Python:有什么办法可以在 GCS 的某个文件夹中列出 obj? - Google Cloud Storage + Python : Any way to list obj in certain folder in GCS? 有什么方法可以将 Python 的 nltk.download('punkt') 导入 Google Cloud Functions? - Any way to import Python's nltk.download('punkt') into Google Cloud Functions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM