Setup
I encountered the 404 problem after following the unaccepted answers of the question AppEngine datastore - backup programatically
I have enabled the Datastore Admin, as suggested by one of the answer provider. I can manually trigger a datastore backup in Google App Engine console and the backup runs without any failure.
The code in this question lives in a module called 'app'. Not 'default'.
The 404 Problem
This is the cron job in cron.yaml.
cron:
- description: Regular backup
url: /_backup/fullbackup
schedule: every 24 hours
The handler of url will put a backup task in a queue, which in turn make a call to
_ah/datastore_admin/backup.create?
gs_bucket_name=%2Fgs%2Ftest.appspot.com%2F21-06-2015&kind=Test&kind=TestContent
&kind=TestDocument&filesystem=gs
(I replaced my app id with 'test' here)
This shows a 404 error in the log.
If I use the above url with my app host name in a brower (i.e. https://test.appspot.com/_ah/datastore_admin/backup.create?
gs_bucket_name=%2Fgs%2Ftest.appspot.com%2F21-06-2015&kind=Test&kind=TestContent
&kind=TestDocument&filesystem=gs
), I get a 404 too.
Here is the relevant code in the handler of the route /_backup/fullbackup
task = taskqueue.add(
url='/_ah/datastore_admin/backup.create',
method='GET',
target='ah-builtin-python-bundle',
params={
'filesystem': 'gs',
'gs_bucket_name': self.get_bucket_name(),
'kind': (
'Test',
'TestContent',
'TestDocument'
)
}
)
Questions:
- What is the cause of the issue?
- Do I need a queue name in the
taskqueue.add
part of python code? - In my cron.yaml, do I need to set target to
ah-builtin-python-bundle
?
EDIT
The datastore-admin built-in has been enabled, as seen in this screenshot.
And there is no dispatch.yaml
It is related to a queue configuration issue.
A 'default' queue definition was present in the app.yaml prior to the implementation of regular backup. The backup tasks are, as a result, not reaching the target 'ah-builtin-python-bundle'
If I define a new queue
Then use this code to insert task,
Then Google app engine can create backup set