Esempio n. 1
0
    def unload(self):
        """Unload this graph from graphscope engine."""
        if self._session is None:
            raise RuntimeError("The graph is not loaded")

        if self._key is None:
            self._session = None
            self._pending_op = None
            return

        # close interactive instances first
        try:
            if (self._interactive_instance_launching_thread is not None and
                    self._interactive_instance_launching_thread.is_alive()):
                # join raises a RuntimeError if an attempt is made to join the current thread.
                # this exception occurs when a object collected by gc mechanism contains a running thread.
                if (threading.current_thread() !=
                        self._interactive_instance_launching_thread):
                    self._interactive_instance_launching_thread.join()
            self._close_interactive_instances()
        except Exception as e:
            logger.error("Failed to close interactive instances: %s" % e)
        try:
            self._close_learning_instances()
        except Exception as e:
            logger.error("Failed to close learning instances: %s" % e)
        if not self._detached:
            op = dag_utils.unload_graph(self)
            op.eval()
        self._key = None
        self._session = None
        self._pending_op = None
Esempio n. 2
0
    def unload(self):
        """Unload this graph from graphscope engine.

        Returns:
            :class:`graphscope.framework.graph.UnloadedGraph`: Evaluated in eager mode.
        """
        op = dag_utils.unload_graph(self)
        return UnloadedGraph(self._session, op)
Esempio n. 3
0
 def unload(self):
     """Unload this graph from graphscope engine."""
     if not self.loaded():
         raise RuntimeError("The graph is not registered in remote.")
     # close interactive instances first
     try:
         self._close_interactive_instances()
     except Exception as e:
         logger.error("Failed to close interactive instances: %s" % e)
     try:
         self._close_learning_instances()
     except Exception as e:
         logger.error("Failed to close learning instances: %s" % e)
     if not self._detached:
         op = unload_graph(self)
         op.eval()
     self._key = None