Hi, Same problem and I have solved it by changing my django's url pattern and updating both cron and app.yml files. Here is the solution.
Django tries to add "/" if you are not using it on end of url. It does that by using Http 301(permanent redirect). It seems app engine code changed to disallow redirection on cron triggered urls because it could cause server to generate lots of requests continuously. so just add "/" to all of your urls(both app and cron files) and url patterns on your django application. By doing this django dont try to add slashes so it will not generate 301. You can check this behavior with development server. On Sep 17, 9:54 pm, ttk <[email protected]> wrote: > Hi Nick, > > Thanks for the response. > > 1. The only thing in my app.yaml that has a login is: > > handlers: > - url: /remote_api > script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py > secure: optional > login: admin > > Is that why 301 is coming up because GAE is checking the user and > redirecting as necessary? Now I'm wondering if I'm entirely a n00b and > need to add a specific handler for the cron job url in app.yaml? But > then how would I trigger a specific method? > > Something like: > - url: /do/store/weekly > script: foo/cron-weekly.py > secure: optional > > 2. Ok > 3. Thanks, good to know. > > Thanks again for helping out. > -Telly > > On Sep 17, 2:59 am, "Nick Johnson (Google)" <[email protected]> > wrote: > > > Hi ttk, > > > On Tue, Sep 15, 2009 at 11:11 PM, ttk <[email protected]> wrote: > > > > Hello, > > > > I'm wondering if anyone is having similar issues with GAE cron jobs / > > > tasks via App Engine Patch? > > > > Intended Flow: > > > 1. Cron job 'do/store/weekly' triggers the creation of a task to build > > > html email. > > > 2. Task executes, builds html email, and stores it in a DB "email > > > queue". > > > 3. Some time after (e.g. +10 min) the 'do/store/weekly' job, another > > > cron triggers the weekly collection of subscribers (email addresses, > > > unsub token) > > > -- How things get broken down at this point is TBD depending on > > > timeout, cpu usage etc.-- > > > 4+. Tasks executes the creation of 1 "send email" task per subscriber > > > (collection of email, html etc), theses tasks in queue execute asap. > > > > Issues: > > > 1. do/store/weekly' is always returning 301. In the response I've > > > tried (lines 24-27) all result in 301 status. Cron returns 200 when > > > user-initiated (hitting the url directly via browser). > > > Are you checking for an admin in the handler? Cron is able to access URLs > > marked as admin only in app.yaml, but users.is_current_user_admin() will > > return False for it. > > > > 2. Intermittent cpu_ms & api_cpu_ms warnings. e.g. Sometimes '/do/ > > > store/weekly' will run without warnings other times it will report: / > > > do/store/weekly 301 1287ms 1613cpu_ms 0kb where both (1287 & 1613) > > > are in red and with warning icons. GAE's cron jobs don't have auto- > > > cancel conditions do they? > > > No. Your task will simply run a bit slower if it consumes excessive amounts > > of CPU. > > > > 3. Cron consistently reporting "on-time Failed". > > > This is due to point 1. > > > -Nick Johnson > > > > Code:http://dpaste.com/hold/94080/ > > > > Any insight would be very appreciated as my searches have come up > > > short. I suspect (read: hope) my other issues are due largely in part > > > to the 301 status, but maybe I've skewed something else up too. > > > > Thanks kindly, > > > -ttk > > > -- > > Nick Johnson, Developer Programs Engineer, App Engine > > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > > 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
