2
votes

I used Cloud Scheduler in triggering HTTP endpoint, http request still processing but cloud scheduler already shown a results that it says "failed". The request will took more than an hour. Take note I used Manual Scaling (can process 24 hrs of request). Where did i go wrong?

3

3 Answers

2
votes

I understand that, after few minute of processing, your Cloud Scheduler job print failed even if the http call continue its processing with error code in return. If so, it's because the default timeout of Cloud Scheduler is about 180s.

I assume that is not a well documented part, and you can't set this up by GUI, but only by gcloud command or API calls.

You can override it by setting yourselves the attempt-deadline parameters, for example like this with gcloud command. You have more detail in the grpc api. Take care of the HTTP call timeout. Limited to 30 minutes, except if you call an AppEngine by HTTP, where you are limited to 24H. Because you said that you used Manual Scaling (can process 24 hrs of request), I assumed that you talk about AppEngine

You have another retry parameters into Cloud Scheduler, also available through gcloud CLI.

1
votes

According to the documentation:

Cloud Scheduler can call HTTP targets that require authentication if you have set up an associated service account that has the appropriate credentials.

  • Please make sure that Cloud Scheduler has identified a Service Account to be used for the call from Cloud Scheduler to your HTTP target.

  • Additionally Cloud Scheduler itself must have a service account of its own that has the Cloud Scheduler Service Agent role granted, so that the appropriate permissions are granted.

By following the subsequent steps you should be able to create and set up a Cloud Scheduler job successfully:

  1. Follow this quickstart in order to understand how Cloud Scheduler works.

  2. Here you may find information on configuring cron job schedules appropriately.

  3. Here you may find the documentation on creating a scheduler job by using authentication with HTTP Targets.

If you receive any error while the job fails, please provide it here by editing your answer, so we can clarify the situation.

I hope this information helps.

1
votes

Currently cloud scheduler don't have GUI for setting up the attempt_deadline thus it can only be set using gcloud. And there is a attempt_deadline limit of what service target cloud scheduler can cater.

For The allowed duration for this deadline is:

For HTTP targets, between 15 seconds and 30 minutes. For App Engine HTTP targets, between 15 seconds and 24 hours. For PubSub targets, this field is ignored.

With this, since i don't want to change my target to AppEngine HTTP. I just created a new HTTP target where it will redirect to the desired HTTP target. With that cloud scheduler request timeout will not be reached.