我创建了一个培训工作,从大查询中获取数据,执行培训并部署模型.我想在这两种情况下自动开始训练:
I created a training job where I fetch my data from big query, perform training and deploy model. I would like to start training automatically in this two cases:
我检查了GCP Cloud Scheduler,但似乎不适合我的情况.
I checked GCP Cloud Scheduler, but it seems its not suitable for my case.
推荐答案Cloud Scheduler是触发计划的正确工具.我不知道你的阻拦剂是什么!
Cloud Scheduler is the right tool to trigger your training on a schedule. I don't know what your blocker is!!
第一点,你不能.您不能在X个新行之后放置触发器(在BigQuery或其他数据库上)以发送事件.为此,我建议您这样做:
For your first point, you can't. You can't put a trigger (on BigQuery or on other database) to send an event after X new rows. For this, I recommend you to do this:
- 使用Cloud Scheduler安排作业(例如,每10分钟安排一次)
- 该工作在BigQuery中执行请求,并检查自上次培训工作以来的行数(上次培训工作的日期必须在某个地方,我建议在另一个BigQuery表中使用)
- 如果行数是>1000,触发您的运行作业
- 否则,退出功能
如您所见,这并不是那么容易,并且有一些警告:
As you see, it's not so easy and there is several caveats:
- 部署模型时,还必须写出最新训练的日期
- 您必须将请求多次执行到BigQuery中.正确分区您的表以限制成本
这对您有意义吗?
编辑
gcloud命令是一个简单"命令.API调用的包装器.尝试将参数-http-log 添加到您的gcloud命令中,以查看调用了哪个API以及使用了哪些参数.
gcloud command is a "simple" wrapper of API calls. Try to add the param --http-log to your gcloud command to see which API is called and with which params.
无论如何,您可以通过致电 API ,如果您想作为示例,请使用gcloud SDK的-http-log 参数!
Anyway, you can start a job by calling this API, and if you want and example, use the --http-log param of gcloud SDK!
更多推荐
如何自动启动AI平台作业?
发布评论