def put(self): """Save the Request to the datastore and memcache and start the process after the first save.""" start_process = False if not self.is_saved(): start_process = True cache.save_to_cache(self) if start_process: # Lookup the start step in the process and create the first batch # of Execution objects to work on the request step = self.process.get_start_step() if not step: raise exceptions.ValidationException( 'Process "%s" does not have a starting step.' % \ self.process) step.queue_tasks(self) import time # Record the request in the Process statistics task = taskqueue.Task(params={'request_key': self.id, 'process_key': self.process.id, 'timestamp': time.time()}) queue = taskqueue.Queue('request-statistics') queue.add(task) return self.key()
def put(self): """Save the model to the datastore and memcache.""" model = cache.save_to_cache(self) if model: return model.key() return None