def delete(self): self.mutex.acquire() self.cam_is_alive = False self.mutex.release() gm.invoke_graph_instance_deactivate(self.cam_id) logging.info('Deactivate stream {0}'.format(self.cam_id))
def init_topology(): instances = gm.invoke_graph_instance_list() if instances['status'] != 200: logger.warning('Failed to invoker direct method', instances['payload']) return -1 logger.info('========== Deleting {0} instance(s) =========='.format( len(instances['payload']['value']))) for i in range(len(instances['payload']['value'])): gm.invoke_graph_instance_deactivate( instances['payload']['value'][i]['name']) gm.invoke_graph_instance_delete( instances['payload']['value'][i]['name']) topologies = gm.invoke_graph_topology_list() if instances['status'] != 200: logger.warning('Failed to invoker direct method', instances['payload']) return -1 logger.info('========== Deleting {0} topology =========='.format( len(topologies['payload']['value']))) for i in range(len(topologies['payload']['value'])): gm.invoke_graph_topology_delete( topologies['payload']['value'][i]['name']) logger.info('========== Setting default grpc topology =========='.format( len(topologies['payload']['value']))) ret = gm.invoke_graph_grpc_topology_set() return 1
def delete(self): # self.mutex.acquire() self.cam_is_alive = False # self.mutex.release() if IS_OPENCV == "true": logger.info("get CVModule") res = requests.get("http://CVCaptureModule:9000/delete_stream/" + self.cam_id) else: gm.invoke_graph_instance_deactivate(self.cam_id) logger.info("Deactivate stream {}".format(self.cam_id))
def init_topology(): """init_topology. Init LVA topologies """ instances = gm.invoke_graph_instance_list() logger.info("instances %s", instances) if "error" in instances.keys(): logger.warning( "[HttpOperationError] Probably caused by invalid IoTHub connection string. The server will terminate in 10 seconds." ) time.sleep(10) sys.exit(-1) if instances["status"] != 200: logger.warning("Failed to invoke direct method: %s", instances["payload"]) return -1 logger.info( "========== Deleting %s instance(s) ==========", len(instances["payload"]["value"]), ) for i in range(len(instances["payload"]["value"])): gm.invoke_graph_instance_deactivate( instances["payload"]["value"][i]["name"]) gm.invoke_graph_instance_delete( instances["payload"]["value"][i]["name"]) topologies = gm.invoke_graph_topology_list() if instances["status"] != 200: logger.warning("Failed to invoker direct method: %s", instances["payload"]) return -1 logger.info( "========== Deleting %s topology ==========", len(topologies["payload"]["value"]), ) for i in range(len(topologies["payload"]["value"])): gm.invoke_graph_topology_delete( topologies["payload"]["value"][i]["name"]) logger.info("========== Setting default grpc/http topology ==========") ret = gm.invoke_topology_set("grpc") ret = gm.invoke_topology_set("http") return 1
def init_topology(): """init_topology. Init LVA topologies """ instances = gm.invoke_graph_instance_list() logger.info("instances %s", instances) if instances["status"] != 200: logger.warning("Failed to invoke direct method: %s", instances["payload"]) return -1 logger.info( "========== Deleting %s instance(s) ==========", len(instances["payload"]["value"]), ) for i in range(len(instances["payload"]["value"])): gm.invoke_graph_instance_deactivate(instances["payload"]["value"][i]["name"]) gm.invoke_graph_instance_delete(instances["payload"]["value"][i]["name"]) topologies = gm.invoke_graph_topology_list() if instances["status"] != 200: logger.warning("Failed to invoker direct method: %s", instances["payload"]) return -1 logger.info( "========== Deleting %s topology ==========", len(topologies["payload"]["value"]), ) for i in range(len(topologies["payload"]["value"])): gm.invoke_graph_topology_delete(topologies["payload"]["value"][i]["name"]) logger.info("========== Setting default grpc/http topology ==========") ret = gm.invoke_topology_set("grpc") ret = gm.invoke_topology_set("http") return 1
def _stop(self): gm.invoke_graph_instance_deactivate(self.cam_id)