def resource_delete(self, resources=None): if not resources or type(resources) != list: log.error("no resources specified") return for res_id in resources: with session_scope() as session: resources = QResources(session=session) resources.kill(res_id)
def resource_delete(self, args): resources = args.resource with session_scope() as session: qresources = QResources(session=session) if args.all: resources = [res.id for res in qresources.up()] elif args.unused: resources = [res.id for res in qresources.ready()] if not resources or type(resources) != list: log.error("no resources specified") return for res_id in resources: with session_scope() as session: qresources = QResources(session=session) qresources.kill(res_id)