def get_all(self, q=None): query = q or [] kwargs = self._query_to_kwargs(query) LOG.debug("INPUT ARGS :%s" % kwargs) instances = [] for ins in request.instancehook.list('1hao', **kwargs): instances.append(Instances.from_db_model(ins)) return instances
def get_one(self, task_id): LOG.debug('input argv %s' % task_id) ins_pool = [] instances = request.instancehook.getInstancesfromtask_id(task_id) LOG.debug('storage in mysql instances : %s' % str(instances)) if instances: for ins in instances: LOG.debug("task completed instance :%s" % str(ins)) instance = Instances.from_db_model(ins) ins_pool.append(instance) t = request.taskhook.get(task_id) LOG.debug('Found task: %s' % t) if t: task = Tasks.from_db_model(t[0], len(ins_pool), ins_pool) return task else: LOG.error("%s Not Found" % task_id) raise exc.NotFound("%s Not Found" % (task_id), '01202')
def get_all(self): instances = [] for ins in request.instancehook.list('1hao'): instances.append(Instances.from_db_model(ins)) return instances