How to cancel or stop Google App Engine Cron Job

Viewed 6038

I deployed an application to my Google App Engine that uses a CRON job. I followed this Tutorial. It works fine, I could confirm it in my GAE console. In my Stackdriver logs I can also see that the CRON job is running.

But all changes that I made to my cron.xml file did not apply after I deployed my application again. I even deleted the cron.xml file and deployed my application again - no effect. I do not want that CRON job to exceed any quota.

  1. Is there a way to cancel /disable / delete a CRON job from the GAE console?
  2. Am I doing anything wrong to cancel the CRON job by modifying and deleting the cron.xml file?
3 Answers

Now with the gcloud tool it's a little bit different:

1 - set proper project:

gcloud config set project my-project

2 - create a file cron.yaml with the following content cron:

3 - upload the new cron file

gcloud app deploy cron.yaml

In some cases (in particular multi-service apps from my experience) simply uploading the app/service may not update the cron configuration automatically. Most likely because the cron config is not a service-level config, it's an app-level one, independent from a particular service.

Which is why there are commands specifically for deploying just the cron configuration. From Uploading cron jobs:

Option 2: Upload only your cron updates

To update just the cron configuration without uploading the rest of the application, run the following command:

./appengine-java-sdk/bin/appcfg.sh update_cron [YOUR_APP_DIR]

And right below that you have Deleting all cron jobs - basically uploading an empty cron config file (as opposed to just deleting the file):

To delete all cron jobs:

A few versions later, using Google Cloud SDK 301.0.0, cron.xml does not deploy as expected. Cloud Scheduler is the present standard.

The reference page explains how to delete all cron jobs. Unfortunately, xml format of cron file is not supported by the mandatory deprecated appCfg tool.

To remove the existing cron jobs, the following was needed:

  • install app-engine-java (gcloud install app-engine-java)
  • as found here, move to directory where appCfg lives
  • create a file name cron.yaml containing the word cron: (i.e. no cron jobs)
  • deploy the empty file like documented using update_cron and the path to the empty cron yaml file.
  • login prompt through browser could occur.

All cron jobs should disappear.

Related