Package org.deeplearning4j.ui.api
Interface UIServer
-
- All Known Implementing Classes:
VertxUIServer
public interface UIServer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidattach(StatsStorage statsStorage)Attach the given StatsStorage instance to the UI, so the data can be visualizedvoiddetach(StatsStorage statsStorage)Detach the specified StatsStorage instance from the UIvoiddisableRemoteListener()Disable the remote listener functionality (disabled by default)voidenableRemoteListener()Enable the remote listener functionality, storing all data in memory, and attaching the instance to the UI.voidenableRemoteListener(StatsStorageRouter statsStorage, boolean attach)Enable the remote listener functionality, storing the received results in the specified StatsStorageRouter.StringgetAddress()Get the address of the UIstatic UIServergetInstance()Get (and, initialize if necessary) the UI server.static UIServergetInstance(boolean multiSession, org.nd4j.common.function.Function<String,StatsStorage> statsStorageProvider)Get (and, initialize if necessary) the UI server.intgetPort()Get the current port for the UIstatic ThreadgetShutdownHook()Get shutdown hook of UI server, that will stop the server when the Runtime is stopped.List<StatsStorage>getStatsStorageInstances()booleanisAttached(StatsStorage statsStorage)Check whether the specified StatsStorage instance is attached to the UI instancebooleanisMultiSession()Check if the instance initialized with one of the factory methods (getInstance()orgetInstance(boolean, Function)) is in multi-session modebooleanisRemoteListenerEnabled()booleanisStopped()voidstop()Stop/shut down the UI server.voidstopAsync(io.vertx.core.Promise<Void> stopCallback)Stop/shut down the UI server.static voidstopInstance()Stop UIServer instance, if already running
-
-
-
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/:sessionIdstatsStorageProvider- 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 itnull.- 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 ExceptionStop 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()orgetInstance(boolean, Function)) is in multi-session mode- Returns:
trueif 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()
Enable the remote listener functionality, storing all data in memory, and attaching the instance to the UI. Typically used withRemoteUIStatsStorageRouter, which will send information remotely to this UI instance
-
enableRemoteListener
void enableRemoteListener(StatsStorageRouter statsStorage, boolean attach)
Enable the remote listener functionality, storing the received results in the specified StatsStorageRouter. If the StatsStorageRouter is aStatsStorageinstance, it may (optionally) be attached to the UI, as ifattach(StatsStorage)was called on it.- Parameters:
statsStorage- StatsStorageRouter to post the received results toattach- 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 callbackPromiseon completion: either callPromise.complete(T)orPromise.fail(java.lang.Throwable).- Parameters:
stopCallback- callbackPromiseto notify on completion
-
getShutdownHook
static Thread getShutdownHook()
Get shutdown hook of UI server, that will stop the server when the Runtime is stopped. You may de-register this shutdown hook withRuntime.removeShutdownHook(Thread), and add your own hook withRuntime.addShutdownHook(Thread)- Returns:
- shutdown hook
-
-