def post(self): task = MigrateTask() task.put() retry_options = taskqueue.TaskRetryOptions(task_retry_limit=0) queue_task = taskqueue.Task(url='/migrate/run', params={"task":task.key.urlsafe()}, retry_options=retry_options) queue_task.add() result = {"message" : "Migration queued and will start in a few seconds...", "id" : task.key.urlsafe()} self.response.headers['Content-Type'] = "application/json" self.response.write(json.dumps(result))
def post(self): task = MigrateTask() task.put() retry_options = taskqueue.TaskRetryOptions(task_retry_limit=0) queue_task = taskqueue.Task(url='/migrate/run', params={"task": task.key.urlsafe()}, retry_options=retry_options) queue_task.add() result = { "message": "Migration queued and will start in a few seconds...", "id": task.key.urlsafe() } self.response.headers['Content-Type'] = "application/json" self.response.write(json.dumps(result))
def get(self): #Check whether the migration is done so we can see whether to show the Blobstore Migration #or not... settings = Settings.get() if not settings.blobstore_migration_done: migration_task_finished = bool(MigrateTask.query(MigrateTask.status == 'finished').get()) if migration_task_finished: settings.blobstore_migration_done = True settings.put() else: #Try to figure out whether this is a new user that has nothing in the blobstore... if not UserImage.query().get(): settings.blobstore_migration_done = True settings.put() self._render(settings)