class ProcessGraphs(ResourceBase): """The /process_graphs endpoint implementation""" def __init__(self): ResourceBase.__init__(self) self.iface = ActiniaInterface() self.iface.set_auth(ActiniaConfig.USER, ActiniaConfig.PASSWORD) self.graph_db = GraphDB() def get(self): """Return all jobs in the job database""" # TODO: Implement user specific database access process_graphs = [] for key in self.graph_db: graph = self.graph_db[key] title = None if "title" in graph: title = graph["title"] description = None if "description" in graph: description = graph["description"] entry = ProcessGraphListEntry(title=title, description=description, id=key) process_graphs.append(entry) return ProcessGraphList(process_graphs=process_graphs).as_response( http_status=200) # no longer supported, replaced by ProcessGraphId def post(self): try: """Store a process graph in the graph database""" # TODO: Implement user specific database access process_graph_id = f"user-graph-{str(uuid4())}" process_graph = request.get_json() self.graph_db[process_graph_id] = process_graph return make_response(process_graph_id, 201) except Exception: e_type, e_value, e_tb = sys.exc_info() traceback_model = dict(message=str(e_value), traceback=traceback.format_tb(e_tb), type=str(e_type)) return ErrorSchema( id="1234567890", code=2, message=str(traceback_model)).as_response(http_status=400) def delete(self): """Clear the process graph database""" self.graph_db.clear() return make_response( "All process graphs have been successfully deleted", 204)
class ProcessGraphs(ResourceBase): """The /jobs endpoint implementation""" def __init__(self): self.iface = ActiniaInterface() self.iface.set_auth(request.authorization.username, request.authorization.password) self.graph_db = GraphDB() def get(self): """Return all jobs in the job database""" # TODO: Implement user specific database access process_graphs = [] for key in self.graph_db: graph = self.graph_db[key] entry = ProcessGraphListEntry(title=graph["title"], description=graph["description"], process_graph_id=key) process_graphs.append(entry) return make_response(ProcessGraphList(process_graphs=process_graphs).to_json(), 200) def post(self): try: """Store a process graph in the graph database""" # TODO: Implement user specific database access process_graph_id = f"user-graph::{str(uuid4())}" process_graph = request.get_json() self.graph_db[process_graph_id] = process_graph return make_response(process_graph_id, 201) except Exception: e_type, e_value, e_tb = sys.exc_info() traceback_model = dict(message=str(e_value), traceback=traceback.format_tb(e_tb), type=str(e_type)) error = ErrorSchema(id="1234567890", code=2, message=str(traceback_model)) return make_response(error.to_json(), 400) def delete(self): """Clear the process graph database""" self.graph_db.clear() return make_response("All process graphs have been successfully deleted", 204)
def __init__(self): self.iface = ActiniaInterface() self.iface.set_auth(request.authorization.username, request.authorization.password) self.db = GraphDB() self.job_db = JobDB() self.actinia_job_db = ActiniaJobDB()
def __init__(self): ResourceBase.__init__(self) self.iface = ActiniaInterface() # really use ActiniaConfig user + pw ? self.iface.set_auth(ActiniaConfig.USER, ActiniaConfig.PASSWORD) self.db = GraphDB() self.job_db = JobDB() self.actinia_job_db = ActiniaJobDB()
def __init__(self): self.iface = ActiniaInterface() self.db = GraphDB()
def __init__(self): ResourceBase.__init__(self) self.iface = ActiniaInterface() self.iface.set_auth(ActiniaConfig.USER, ActiniaConfig.PASSWORD) self.db = GraphDB()
def __init__(self): ResourceBase.__init__(self) self.iface = ActiniaInterface() self.db = GraphDB()