Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run GAE cron jobs as specific app version?

Recently I've started using limited staging on my Google App Engine project. The data is still shared between all versions, but behaviour (especially user facing behaviour) is different.

Naturally when I implement something incredibly new it only runs on the latest version of my code and I don't feel like it should be backported to the older versions.

Some of this new functionality requires cron jobs to be run periodically, but I'm hitting a problem. I have to run a cron job to call the latest code, but this is what Google's documentation has to say about the issue:

Cron requests are always sent to the default version of the application.

The default version is the oldest because the first versions of the client code that went out to users weren't future proof and don't know how to select which API version to call.

So my question is, how can I get around this limitation and make a cron job that will call the latest rather than the default version of the application?

like image 762
Swizec Teller Avatar asked Feb 06 '11 14:02

Swizec Teller


2 Answers

You can now specify a version using the target tag.

<target>version-2</target>
like image 195
Andrew Uricchio Avatar answered Nov 11 '22 07:11

Andrew Uricchio


You can't change the cron jobs to run on a different version then the default.

Depending on how much time your cron job takes to run you could change your cron job script to to do a URLFetch to "http://latest.appname.appspot.com/cron_job_endpoint".

If you're cron job takes longer then 10 minutes to run, then I would design it in a way that you can chain the different tasks using task queues.

like image 34
dplouffe Avatar answered Nov 11 '22 07:11

dplouffe