I have an App Engine server with two instances - the first is the main, active instance and the second is a test instance. This setup allows me to test features on existing datastore entries without screwing up the active server too much.
I'm trying to set up a cron job for a new servlet endpoint that I added on instance 2, but the cron job tries to access the default endpoint (which doesn't exist), and specifying the full url to the second instance is not allowed. Here's what I tried (3 variations):
<cronentries>
<cron>
1. <url>2-dot-my-app.appspot.com/ping</url> // doesn't work
2. <url>/ping</url> // this tries to access the default instance
3. <url>/ping</url> // tried this long-shot as well, obviously didn't work
<target>v3</target>
<schedule>every 2 minutes</schedule>
</cron>
</cronentries>
Does anybody have suggestions?
The answer was more straightforward than I thought:
<cronentries>
<cron>
<url>/ping</url>
<target>3</target>
<schedule>every 2 minutes</schedule>
</cron>
</cronentries>
Related
We have multiple App Engine Cron entries triggering our App Engine application, but recently we detected a decrease on the number of the processed events handled by one of the endpoints of our application. By looking at the App Engine Cron logs for this specific Cron entry on StackDriver, we found out that, during the days we invesgated (March 11-15), that are missing entries. Most of the missing triggers coincide through the days (12:15, 14:15, 16:15, 18:15, 20:15, 22:15, 00:15).
The screenshot below displays one specific day, and the red lines indicate the missing entries:
There are no requests with HTTP status code different than 200.
This is the configuration of the specific Cron entry (replaced some words with XXX due to business restrictions):
- description: 'Hourly job for XXX'
url: /schedule/bigquery/XXX
schedule: every 1 hours from 00:15 to 23:15
timezone: UTC
target: XXX
retry_parameters:
min_backoff_seconds: 2.5
max_doublings: 5
Could someone # GCP side take a look? The task name is 53751dd6a70fb9af38f49993b122b79f.
it seems like if the request takes longer than an hour, then the next one gets skipped (i.e. cron doesn't launch the next iteration if the current iteration is still running)
maybe do the actual work in a separate task and then the only thing the cron task does is launch this separate task
As the title says, I have a number of cron jobs set up on my Java web application hosted on AppEngine standard environment, but one or two of them fail to run.
Examining the logs, I can see that the httpRequest for the ones that fail have 302 error code, indicating that the URL can't be found. The ones that work, return 200 as expected.
I can manually invoke the cron jobs' URLs and they work so it doesn't appear to really be a 302 problem. From the logs, Chrome sees a 200 response, but AppEngine sees 302:
The cron.xml file is in the correct place and works for the other jobs. this is the cron entry that's failing:
<cronentries>
<cron>
<url>/home/cron/boatactivity/</url>
<description>generate activities for boat movement</description>
<schedule>every 3 hours from 00:00 to 21:00</schedule>
</cron>
</cronentries>
And this is how it looks in the console:
I've checked an double checked the configuration and can't figure out what the problem is.
Any suggestions please?
I've the following in cron.xml on my WEB-INF directory:
?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/?brtyuioacdwer</url>
<description>Load datastore</description>
<schedule>every monday 06:17</schedule>
<timezone>America/New_York</timezone>
</cron>
</cronentries>
But when the time comes to execute the shown URL nothing seems to happen as my datastore keeps the same, of course I've tested to call the URL from browser and it does its work nicely and I've uploaded new version of the app several minutes before it should be automatically executing. I don't know if there might be some problems with cron jobs when they try to write on datastore or if they are not the default version af the web application, so I'm asking for some guide.
Thanks for your attention.
(If this is not a question for SO, I will be gladly moved elsewhere)
I have a GAE backend that I want to start regularly with cron. With the help of other questions from SO, I set up backends.xml like this
<?xml version="1.0" encoding="UTF-8"?>
<backends>
<backend name="myBackend">
<class>B1</class>
<instances>1</instances>
<options>
<dynamic>true</dynamic>
</options>
</backend>
</backends>
and my cron.xml like this
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/doHardStuff</url>
<description>doing long running stuff</description>
<schedule>every 3 hours</schedule>
<target>myBackend</target>
</cron>
</cronentries>
And I upload it using mvn-gae (I am writing everything in java with maven) with goals gae:deploy gae:backends-list gae:backends-update
Everything loads fine and the long running stuff is done, however. Even after finishing everything, the dynamic backend still runs and eats my daily backend quota. I can see _ah/stop request in logs after the servlet finishes its job; however the backend still runs after that.
If I stop it manually in engine web console in Main -> Backends -> Start/Stop, it stops eating my quota, however, it won't run at a given time in cron and the cron job will fail.
What should I do? I want the backend to start at the given time and stop when the request is over and the machine is idle. I don't want it running at a different time.
It's working as it's supposed to. Dynamic backends are always "started" in the backends tab in the dashboard, which just means they can get requests and start instances if needed. This doesn't consume any quota.
When the backend gets a request it starts an instance using /_ah/start/ and consumes quota. When it doesn't have any requests to serve for some minutes it stops the instance with an /_ah/stop/ request.
To figure out if the backend instance is still running, change to the instances tab and select the backend "version".
Note that dynamic backends have a 15 minutes quota penalty, which is probably why the quota usage is higher than expected.
For dynamic backends, billing ends fifteen minutes after the last
request has finished processing.
http://developers.google.com/appengine/docs/python/backends/overview#Billing_Quotas_and_Limits
It seems like it takes them 15 minutes to be stopped, according to some pages online.
This seems possible, I will try it.
I start developing Google Appengine Java Application..for that I am using Servlet, jsp and EClipse helios IDE.
In my Application, I want to create a servlet, that will execute for Particular time interval(every 5 minutes) and the the get values are stored in datastore.....
How to do this...Also i go through about Scheduling tasks here.But I didn't understand how to implement in my project using Eclipse....
Please help me.....
You just need to create a servlet that will handle requests to the URL you specify in your cron config. Your cron.xml gets saved in the same location as your appengine-web.xml.
cron job in AppEngine uses http GET, so just any servlet that handles doGet() will suffice.
suppose your servlet is mapped to /mytask in web.xml, then in cron.xml,
<cron>
<url>/mytask</url>
<description>describe your task here</description>
<schedule>every 1 minutes</schedule>
</cron>
this instructs appengine to issue a httpGet at URL /mytask every minute.