def delete(model: str, **kwargs: Any) -> dict: instance = Session.query(models[model]).filter_by(**kwargs).first() if hasattr(instance, "type") and instance.type == "Task": instance.delete_task() serialized_instance = instance.serialized Session.delete(instance) return serialized_instance
def delete(model, allow_none=False, **kwargs): instance = Session.query(models[model]).filter_by(**kwargs).first() if allow_none and not instance: return None instance.delete() serialized_instance = instance.serialized Session.delete(instance) return serialized_instance
def delete(model: str, allow_none: Any = False, **kwargs: Any) -> Any: instance = Session.query(models[model]).filter_by(**kwargs).first() if allow_none and not instance: return None if hasattr(instance, "type") and instance.type == "Task": instance.delete_task() serialized_instance = instance.serialized Session.delete(instance) return serialized_instance
def delete_node(self, workflow_id, service_id): workflow, service = ( fetch("workflow", id=workflow_id), fetch("service", id=service_id), ) workflow.services.remove(service) if not service.shared: Session.delete(service) now = self.get_time() workflow.last_modified = now return {"service": service.serialized, "update_time": now}
def clear_results(self, job_id: int) -> None: for result in fetch("Run", all_matches=True, allow_none=True, job_id=job_id): Session.delete(result)
def clear_results(self, service_id): for result in fetch("run", all_matches=True, allow_none=True, service_id=service_id): Session.delete(result)