如何从gcp函数暂停和恢复gcp调度程序



如果条件为true,我一直在尝试暂停云调度程序,而这一切都可以在一个仅使用Python的函数中完成。那么,这可能吗?请帮我

在文档中,您有暂停和恢复作业的示例。

暂停:

from google.cloud import scheduler_v1
def sample_pause_job():
# Create a client
client = scheduler_v1.CloudSchedulerClient()
# Initialize request argument(s)
request = scheduler_v1.PauseJobRequest(
name="name_value",
)
# Make the request
response = client.pause_job(request=request)
# Handle the response
print(response)

用于恢复:

from google.cloud import scheduler_v1
def sample_resume_job():
# Create a client
client = scheduler_v1.CloudSchedulerClient()
# Initialize request argument(s)
request = scheduler_v1.ResumeJobRequest(
name="name_value",
)
# Make the request
response = client.resume_job(request=request)
# Handle the response
print(response)

相关内容

  • 没有找到相关文章

最新更新