Interface UIServer

  • All Known Implementing Classes:
    VertxUIServer

    public interface UIServer
    • Method Detail

      • getInstance

        static UIServer getInstance()
                             throws org.deeplearning4j.exception.DL4JException
        Get (and, initialize if necessary) the UI server. This synchronous function will wait until the server started. Singleton pattern - all calls to getInstance() will return the same UI instance.
        Returns:
        UI instance for this JVM
        Throws:
        org.deeplearning4j.exception.DL4JException - if UI server failed to start; if the instance has already started in a different mode (multi/single-session); if interrupted while waiting for completion
      • getInstance

        static UIServer getInstance​(boolean multiSession,
                                    org.nd4j.common.function.Function<String,​StatsStorage> statsStorageProvider)
                             throws org.deeplearning4j.exception.DL4JException
        Get (and, initialize if necessary) the UI server. This synchronous function will wait until the server started. Singleton pattern - all calls to getInstance() will return the same UI instance.
        Parameters:
        multiSession - in multi-session mode, multiple training sessions can be visualized in separate browser tabs.
        URL path will include session ID as a parameter, i.e.: /train becomes /train/:sessionId
        statsStorageProvider - function that returns a StatsStorage containing the given session ID.
        Use this to auto-attach StatsStorage if an unknown session ID is passed as URL path parameter in multi-session mode, or leave it null.
        Returns:
        UI instance for this JVM
        Throws:
        org.deeplearning4j.exception.DL4JException - if UI server failed to start; if the instance has already started in a different mode (multi/single-session); if interrupted while waiting for completion
      • stopInstance

        static void stopInstance()
                          throws Exception
        Stop UIServer instance, if already running
        Throws:
        Exception
      • isStopped

        boolean isStopped()
      • isMultiSession

        boolean isMultiSession()
        Check if the instance initialized with one of the factory methods (getInstance() or getInstance(boolean, Function)) is in multi-session mode
        Returns:
        true if the instance is in multi-session
      • getAddress

        String getAddress()
        Get the address of the UI
        Returns:
        Address of the UI
      • getPort

        int getPort()
        Get the current port for the UI
      • attach

        void attach​(StatsStorage statsStorage)
        Attach the given StatsStorage instance to the UI, so the data can be visualized
        Parameters:
        statsStorage - StatsStorage instance to attach to the UI
      • detach

        void detach​(StatsStorage statsStorage)
        Detach the specified StatsStorage instance from the UI
        Parameters:
        statsStorage - StatsStorage instance to detach. If not attached: no op.
      • isAttached

        boolean isAttached​(StatsStorage statsStorage)
        Check whether the specified StatsStorage instance is attached to the UI instance
        Parameters:
        statsStorage - StatsStorage instance to attach
        Returns:
        True if attached
      • getStatsStorageInstances

        List<StatsStorage> getStatsStorageInstances()
        Returns:
        A list of all StatsStorage instances currently attached
      • enableRemoteListener

        void enableRemoteListener​(StatsStorageRouter statsStorage,
                                  boolean attach)
        Enable the remote listener functionality, storing the received results in the specified StatsStorageRouter. If the StatsStorageRouter is a StatsStorage instance, it may (optionally) be attached to the UI, as if attach(StatsStorage) was called on it.
        Parameters:
        statsStorage - StatsStorageRouter to post the received results to
        attach - Whether to attach the given StatsStorage instance to the UI server
      • disableRemoteListener

        void disableRemoteListener()
        Disable the remote listener functionality (disabled by default)
      • isRemoteListenerEnabled

        boolean isRemoteListenerEnabled()
        Returns:
        Whether the remote listener functionality is currently enabled
      • stop

        void stop()
           throws InterruptedException
        Stop/shut down the UI server. This synchronous function should wait until the server is stopped.
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • stopAsync

        void stopAsync​(io.vertx.core.Promise<Void> stopCallback)
        Stop/shut down the UI server. This asynchronous function should immediately return, and notify the callback Promise on completion: either call Promise.complete(T) or Promise.fail(java.lang.Throwable).
        Parameters:
        stopCallback - callback Promise to notify on completion