我正在从gcp AI平台移植定制的工作培训到顶点AI。我能够开始一个作业,但找不到如何获得状态和如何将日志流到本地客户端。
对于AI平台,我用它来获得状态:
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']这个用来流日志:
cmd = 'gcloud ai-platform jobs stream-logs ' + job_id这不适用于顶点AI作业。替换代码是什么?
发布于 2022-07-15 03:12:46
您可以尝试以下命令来处理流日志:
gcloud ai custom-jobs stream-logs 123 --region=europe-west4123是自定义作业的ID,在这种情况下,您还可以添加glcoud宽标志,例如--。
有关此命令和其他可用标志的更多详细信息,您可以访问此链接。
https://stackoverflow.com/questions/72986981
复制相似问题