def get_data(self, **kwargs): try: execution_id = self.kwargs['execution_id'] tasks = api.task_list(self.request, execution_id) except Exception: msg = _('Unable to get task by execution id "%s".') % execution_id redirect = reverse('horizon:mistral:executions:index') exceptions.handle(self.request, msg, redirect=redirect) return tasks
def get_data(self, **kwargs): try: execution_id = self.kwargs['task_id'] tasks = api.task_list(self.request, execution_id) except Exception: msg = _('Unable to get task by execution id "%s".') % execution_id redirect = reverse('horizon:mistral:executions:index') exceptions.handle(self.request, msg, redirect=redirect) return tasks
def get_single_data(request, id, type="execution"): """Get Execution or Task data by ID. :param request: Request data :param id: Entity ID :param type: Request dispatch flag, Default: Execution """ if type == "execution": try: execution = api.execution_get(request, id) except Exception: msg = _('Unable to get execution by its ID"%s".') % id redirect = reverse('horizon:mistral:executions:index') exceptions.handle(request, msg, redirect=redirect) return execution elif type == "task": try: task = api.task_get(request, id) except Exception: msg = _('Unable to get task by its ID "%s".') % id redirect = reverse('horizon:mistral:tasks:index') exceptions.handle(request, msg, redirect=redirect) return task elif type == "task_by_execution": try: task = api.task_list(request, id)[0] except Exception: msg = _('Unable to get task by Execution ID "%s".') % id redirect = reverse('horizon:mistral:executions:index') exceptions.handle(request, msg, redirect=redirect) return task
def get_data(self): return api.task_list(self.request)
def get_data(self): return api.task_list(self.kwargs['execution_id'])