问题标签 [google-cloud-scheduler]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
5298 浏览

google-cloud-platform - GCP Cloud Scheduler 为 HTTP 目标类型抛出错误

我创建了一个 GCP Cloud Scheduler 作业,每 15 分钟运行一次。它应该从我的 Node js 应用程序调用 API。在控制台中,作业定义如下所示:

当它运行时,它会在日志中返回以下内容:

如何找到有关错误的更多信息?

0 投票
2 回答
618 浏览

google-cloud-platform - Google Cloud Scheduler 在每天特定时间后启动任务,但前提是 Pub/Sub 消息到达

是否可以在 Google Cloud 中实现调度程序和发布/订阅之间的互操作性,以便在每天特定时间后触发任务,但前提是消息到达?

更新:

例如,安排在上午 10:00 的任务等待消息(先决条件)。

  1. 10:00 消息还没到。作业未触发。消息在 11:00 到达。作业被触发。(然后它可以发送一个消息来启动要执行的任务)
  2. 09:00 消息到达。作业未执行。10:00 触发作业。
  3. 味精永远不会到达。该作业永远不会执行。
0 投票
1 回答
1485 浏览

node.js - Firebase CloudScheduler GCLOUD_PROJECT 错误

这是我的功能,顶部是配置,底部是功能

这些是我的依赖

但是firebase会抛出一个错误

使用schedule-functions时也会出现该错误

0 投票
1 回答
523 浏览

google-cloud-platform - Google Cloud insufficient auth scope to call cloud function

I am trying to call a cloud function which shuts down a VM Instance with:

This works perfectly fine when I run it from my local machine or from gcloud console. But I need to be able to run it from inside the instance itself and when I try to do that, this is the error that gets thrown:

Essentially I want to be able to schedule a script to run daily (it'll run for about 2-3 hours). So I've used cloud scheduler to call the cloud function which starts the script at 12 AM every day, and it works, but I need to be able to shut down the instance (to avoid unnecessary charges being added) after the script finishes running. So, I need to be able to call the function from inside the instance itself.

Any other suggestions to achieve my goal would be highly appreciated.

0 投票
1 回答
532 浏览

google-cloud-platform - 有没有办法在 GCP 上将 gsutil 作为常规 Linux cronjob 运行?

我有一个脚本,可以用和gcloud之类的工具来做一些事情,例如:gsutilbq

这适用于我的机器或虚拟机,但我不能保证它会一直开启,所以我想将它添加为 GCP cronjob/Lambda 类型的东西。从这里的文档来看,Cloud Scheduler 似乎只能执行 HTTP 请求、Pub/Sub 或 App Engine HTTP,这些都不是我想要的。

那么:GCP 中是否有任何方法可以自动执行某些gsutil/bq命令,例如 cronjob,但无需我提供永远在线的机器

0 投票
1 回答
772 浏览

google-cloud-platform - Cloud Scheduler 不尊重我的超时设置(编辑:与 CloudRun 无关)

我创建了一个请求超时为 900 秒的 CloudRun 容器。它是由 CloudScheduler cron 作业触发的,该作业也假设超时为 900 秒(使用“--timeout 900”),但在 300 秒后(默认超时)我收到 504 超时错误并且我的容器会减速。

我遵循了这个答案:如何增加 Cloud Scheduler 请求超时期限?但它似乎不适用于非测试版 Cloud Scheduler。

0 投票
2 回答
430 浏览

python - 使用 Cloud Functions 和 Cloud Scheduler 创建到 BigQuery 的数据管道

我正在尝试构建一个数据管道,该管道将从该网站下载数据并将其推送到 BigQuery 表。

问题是在云函数中定义函数后,我将在云调度程序中运行脚本,它会说函数已运行,但 BigQuery 中不会显示任何数据。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

以下是日志:[ { "insertId": "1idtfdbg5drzu63", "jsonPayload": { "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader" }, "httpRequest": { "status": 200 }, "resource": { "type": "cloud_scheduler_job", "labels": { "project_id": "oh-data-pipeline", "location": "us-east4", "job_id": "OH_Voterfile_Data_Loader" } }, "timestamp": "2020-01-01T21:12:39.949108697Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T21:12:39.949108697Z" }, { "insertId": "k9f9cjg5ds4bft", "jsonPayload": { "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptStarted", "scheduledTime": "2020-01-06T05:00:00.271618Z" }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T21:12:39.823311702Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T21:12:39.823311702Z" }, { "insertId": "1xnnrrug5g0c2qj", "jsonPayload": { "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader" }, "httpRequest": { "status": 200 }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T21:12:37.290359769Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T21:12:37.290359769Z" }, { "insertId": "sv8ssdg5e3blni", "jsonPayload": { "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptStarted", "scheduledTime": "2020-01-06T05:00:00.183767Z", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader" }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T21:12:36.916739031Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T21:12:36.916739031Z" }, { "insertId": "7i1kgtfutdv2s", "jsonPayload": { "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished" }, "httpRequest": { "status": 200 }, "resource": { "type": "cloud_scheduler_job", "labels": { "project_id": "oh-data-pipeline", "location": "us-east4", "job_id": "OH_Voterfile_Data_Loader" } }, "timestamp": "2020-01-01T19:37:07.201347795Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T19:37:07.201347795Z" }, { "insertId": "19io9oog5fvqy42", "jsonPayload": { "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptStarted", "scheduledTime": "2020-01-06T05:00:00Z", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline" }, "resource": { "type": "cloud_scheduler_job", "labels": { "location": "us-east4", "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline" } }, "timestamp": "2020-01-01T19:37:07.092810676Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T19:37:07.092810676Z" }, { "insertId": "1t7pz9vg5e70eo5", "jsonPayload": { "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished" }, "httpRequest": { "status": 200 }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T17:30:00.396767720Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T17:30:00.396767720Z" }, { "insertId": "1p23vr0g59sba7d", "jsonPayload": { "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptStarted", "scheduledTime": "2020-01-01T17:30:00.250018Z", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader" }, "resource": { "type": "cloud_scheduler_job", "labels": { "location": "us-east4", "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline" } }, "timestamp": "2020-01-01T17:30:00.267802278Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T17:30:00.267802278Z" }, { "insertId": "1yi5eng4p1lgiq", "jsonPayload": { "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline" }, "httpRequest": { "status": 200 }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T17:26:15.268636308Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T17:26:15.268636308Z" }, { "insertId": "1u1dz02g41np17v", "jsonPayload": { "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptStarted", "scheduledTime": "2020-01-01T17:30:00.369545Z" }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T17:26:15.133041426Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T17:26:15.133041426Z" }, { "insertId": "1gzxg1lg4qi1i28", "jsonPayload": { "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader", "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline" }, "httpRequest": { "status": 200 }, "resource": { "type": "cloud_scheduler_job", "labels": { "job_id": "OH_Voterfile_Data_Loader", "project_id": "oh-data-pipeline", "location": "us-east4" } }, "timestamp": "2020-01-01T17:22:41.388248918Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T17:22:41.388248918Z" }, { "insertId": "1es7ag9g5bdguh5", "jsonPayload": { "targetType": "HTTP", "url": "https://us-central1-oh-data-pipeline.cloudfunctions.net/OH_Data_Pipeline", "@type": "type.googleapis.com/google.cloud.scheduler.logging.AttemptStarted", "scheduledTime": "2020-01-01T17:30:00.257483Z", "jobName": "projects/oh-data-pipeline/locations/us-east4/jobs/OH_Voterfile_Data_Loader" }, "resource": { "type": "cloud_scheduler_job", "labels": { "project_id": "oh-data-pipeline", "location": "us-east4", "job_id": "OH_Voterfile_Data_Loader" } }, "timestamp": "2020-01-01T17:22:41.268121872Z", "severity": "INFO", "logName": "projects/oh-data-pipeline/logs/cloudscheduler.googleapis.com%2Fexecutions", "receiveTimestamp": "2020-01-01T17:22:41.268121872Z" } ]

你能帮我弄清楚为什么这不起作用吗?

0 投票
1 回答
141 浏览

google-cloud-platform - 如何在 openapi yml 文件中添加服务帐户安全定义

我想向 API 添加安全定义以在谷歌云调度程序中运行它(使用 OIDC 令牌和服务帐户)。我的 openapi.yml 看起来像这样

但是当我通过云调度程序调用此 API(使用 OIDC 令牌和服务帐户(xx@example.iam.gserviceaccount.com))时,它失败了。日志视图显示未经授权的 401。如何解决此错误。

0 投票
2 回答
2929 浏览

google-cloud-platform - 如何每 5 分钟运行一次 Cloud Scheduler 作业

我目前已5 * * * *设置为我的 Cloud Scheduler 作业的频率。通过查看文档,我希望它每 5 分钟运行一次;但是,我改为每小时查看结果。

怎么了?

0 投票
0 回答
761 浏览

firebase - Firebase 计划功能在更新/部署时触发

我在使用 Firebase 计划的云功能时出现了一些意外行为。该功能设置为每晚凌晨 4 点运行,并且按预期工作。使用 firebase cli deploy 部署云功能时,会立即执行此功能。改不改都没关系。

我一直试图弄清楚这种情况何时发生,因为并非每次部署都会发生这种情况。它似乎只发生在每天的第一次部署中。如果我再次部署云功能,部署完成后,计划的功能不会再次执行。

是否有任何时间计划的功能预计在部署时立即运行?我怎样才能防止这种情况发生?


编辑:添加了示例代码。我还做了一些测试。不需要的执行以某种方式与 cron 计划相关联。

我将函数更改为 .schedule('*/15 * * * *'),每 15 分钟一次,结果如下

13.00 - 按计划执行的功能
13.05 - 再次部署功能。计划功能再次执行
13.10 - 再次部署功能。未执行函数
13.15 - 函数按计划执行

所以我会说计划执行后的第一次部署会导致函数再次执行,而后续部署不会。在每次部署中,我更新了一个 console.log,我可以看到它是执行的 PREVIOUS 版本。

我还可以提到一切都是用打字稿写的
firebase-admin: 8.9.0,
firebase-functions: 3.3.0
firebase-tools: 7.7.0

索引.ts