0
votes

I have some cron jobs configured in cron.xml in an application on Google App Engine.
These jobs work once a day on a version of my application and make some work on the db.
For example a cron job calls v1.myapp.appspot.com...

After some weeks this application instance seems to no longer work correctly. It does not execute the cron jobs as I expect.

On GAE Dashboard I found a section with a list of cron job, but I can't see my cron jobs there.

Why did they disapper? What's wrong with my configuration environment? or Why google stops the execution of my cron jobs?

1
Did you deploy some other version of the app or updated cron jobs since that cron job was working? - Dan Cornilescu
Might also help showing the cron.xml content for the missing job(s) - Dan Cornilescu
It could also be that you're running it on a backend instance. Check your target, and versions, and deploy matching versions and yaml files (app.yaml, cron.yaml, backend.yaml, etc.) - GAEfan
@DanCornilescu Yes, Originally I have a version with cron jobs. Then I added another version with other cron job. - Andrea
@GAEfan What's the difference beetween set the version in a cron job in the cron.xml file and not set the version? If I don't set the version the cron run on the default version, otherwise no. But if I have, for example, only one version which is the default and I don't set the verion in the cron job, there can be some problems? - Andrea

1 Answers

0
votes

The cron job configuration is an app-wide scope configuration, it's not a configuration of a specific service/version. Every cron deployment (which can be done without necessarily updating a service/version) will overwrite the previously deployed one.

To avoid accidental errors personally I have a single cron config file at the app level, symlinked inside each service as needed.

If you want to keep the cron job for an older version running you need to add a configuration entry for it with a target matching that service/version, otherwise the cron job will stop working when that version is no longer the default one (as the cron-triggered requests will be directed towards the default service/version):

From Creating a cron job:

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
  <cron>
    <url>/tasks/summary</url>
    <target>beta</target>
    <description>daily summary job</description>
    <schedule>every 24 hours</schedule>
  </cron>
</cronentries>

The target specification is optional and is the name of a service/version. If present, the target is prepended to your app's hostname, causing the job to be routed to that service/version. If no target is specified, the job will run in the default version of the default service.