简体   繁体   English

将自定义作业从 GCP AI 平台移植到 Vertex AI - 如何获取作业的状态和日志?

[英]Porting custom job from GCP AI Platform to Vertex AI - how to get state and logs of job?

I am porting custom job training from gcp AI Platform to Vertex AI.我正在将自定义工作培训从 gcp AI 平台移植到 Vertex AI。 I am able to start a job, but can't find how to to get the status and how to stream the logs to my local client.我可以开始工作,但找不到如何获取状态以及如何将日志流式传输到我的本地客户端。

For AI Platform I was using this to get the state:对于 AI Platform,我使用它来获取状态:

from google.oauth2 import service_account
from googleapiclient import discovery
scopes = ['https://www.googleapis.com/auth/cloud-platform']
credentials = service_account.Credentials.from_service_account_file(keyFile, scopes=scopes)
ml_apis = discovery.build("ml","v1", credentials=credentials, cache_discovery=False)
x = ml_apis.projects().jobs().get(name="projects/%myproject%/jobs/"+job_id).execute()  # execute http request
return x['state']

And this to stream the logs:这可以流式传输日志:

cmd = 'gcloud ai-platform jobs stream-logs ' + job_id

This does not work for Vertex AI job.这不适用于 Vertex AI 作业。 What is the replacement code?什么是替换代码?

Can you try this command for streaming logs :您可以尝试使用此命令获取流式日志吗:

gcloud ai custom-jobs stream-logs 123 --region=europe-west4

123 is the ID of the custom job for this case, you can add glcoud wide flags such as --format as well. 123 是这种情况下自定义作业的ID ,您也可以添加 glcoud 宽标志,例如 --format 。

You can visit this link for more details about this command and additional flags available.您可以访问此链接以获取有关此命令和其他可用标志的更多详细信息。

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

相关问题 自定义作业中未显示 Google Cloud Platform Vertex AI 日志 - Google Cloud Platform Vertex AI logs not showing in custom job 我如何在谷歌云平台上跟踪顶点 ai 自定义作业的成本 - how do I track the cost of a vertex ai custom job on google cloud platform 如何从 GCP Cloud Build 管道内提交 GCP AI Platform 训练作业? - How to submit a GCP AI Platform training job frominside a GCP Cloud Build pipeline? 当 Vertex AI 训练作业失败(3 次尝试后)时,如何创建日志路由器接收器? - How to create a Logs Router Sink when a Vertex AI training job failed (after 3 attempts)? 如何在 GCP AI Platform 训练作业中挂载 ram-disk / tmpfs? - How to mount ram-disk / tmpfs in GCP AI Platform Training Job? GCP 的 Vertex AI(AI Platform) PipelineServiceClient 给出未实现的错误 - GCP's Vertex AI(AI Platform) PipelineServiceClient gives unimplemented error 无法在 Vertex AI 自定义作业中使用“gcloud auth print-identity-token” - Cannot use `gcloud auth print-identity-token` from within Vertex AI Custom Job 如何将 AI Platform Training 作业连接到 Cloud SQL PSQL DB? - How to connect AI Platform Training job to Cloud SQL PSQL DB? Google AI Platform 培训 - 等待工作完成 - Google AI Platform training - wait for the job to finish 我们如何在 AI Platform Training 上获取 GCP 项目 ID? - How can we get GCP Project ID on AI Platform Training?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM