Lubricy
Lubricy

Reputation: 47

How to make my program add a cron job automatically with GAE?

I need to make a bot who can automatically add a cron job for itself,but I don't think I could access the cron.yaml file on GAE server.What can I do with this?

Upvotes: 2

Views: 306

Answers (2)

Ibrahim Arief
Ibrahim Arief

Reputation: 9106

You could tell the bot to add the new schedule in your datastore instead.

Then create a single "master" cron job with 1 minute schedule that checks the schedules that you had set in the datastore. The cron job would then determine whether on the current time the handler for an associated schedule need to be invoked or not.

If it does, the master cron job would then invoke the stored job using the TaskQueue API.

Upvotes: 3

htmldrum
htmldrum

Reputation: 2449

It's true that a lot of dev environments don't give you access to the cron.yaml files, however, you can run a Python script locally that communicates with your deployed program, edits your local copy of cron.yaml and pushes up the changes.

Upvotes: 0

Related Questions