Search in sources :

Example 1 with StatsStorageListener

use of org.deeplearning4j.api.storage.StatsStorageListener in project deeplearning4j by deeplearning4j.

the class PlayUIServer method detach.

@Override
public synchronized void detach(StatsStorage statsStorage) {
    if (statsStorage == null)
        throw new IllegalArgumentException("StatsStorage cannot be null");
    if (!statsStorageInstances.contains(statsStorage))
        //No op
        return;
    boolean found = false;
    for (Pair<StatsStorage, StatsStorageListener> p : listeners) {
        if (p.getFirst() == statsStorage) {
            //Same object, not equality
            statsStorage.deregisterStatsStorageListener(p.getSecond());
            listeners.remove(p);
            found = true;
        }
    }
    for (UIModule uiModule : uiModules) {
        uiModule.onDetach(statsStorage);
    }
    if (found) {
        log.info("StatsStorage instance detached from UI: {}", statsStorage);
    }
}
Also used : InMemoryStatsStorage(org.deeplearning4j.ui.storage.InMemoryStatsStorage) StatsStorage(org.deeplearning4j.api.storage.StatsStorage) UIModule(org.deeplearning4j.ui.api.UIModule) QueuePairStatsStorageListener(org.deeplearning4j.ui.storage.impl.QueuePairStatsStorageListener) StatsStorageListener(org.deeplearning4j.api.storage.StatsStorageListener) QueueStatsStorageListener(org.deeplearning4j.ui.storage.impl.QueueStatsStorageListener)

Example 2 with StatsStorageListener

use of org.deeplearning4j.api.storage.StatsStorageListener in project deeplearning4j by deeplearning4j.

the class InMemoryStatsStorage method putStorageMetaData.

@Override
public void putStorageMetaData(StorageMetaData storageMetaData) {
    List<StatsStorageEvent> sses = checkStorageEvents(storageMetaData);
    SessionTypeId id = new SessionTypeId(storageMetaData.getSessionID(), storageMetaData.getTypeID());
    this.storageMetaData.put(id, storageMetaData);
    StatsStorageEvent sse = null;
    if (listeners.size() > 0)
        sse = new StatsStorageEvent(this, StatsStorageListener.EventType.PostMetaData, storageMetaData.getSessionID(), storageMetaData.getTypeID(), storageMetaData.getWorkerID(), storageMetaData.getTimeStamp());
    for (StatsStorageListener l : listeners) {
        l.notify(sse);
    }
    notifyListeners(sses);
}
Also used : StatsStorageEvent(org.deeplearning4j.api.storage.StatsStorageEvent) StatsStorageListener(org.deeplearning4j.api.storage.StatsStorageListener)

Example 3 with StatsStorageListener

use of org.deeplearning4j.api.storage.StatsStorageListener in project deeplearning4j by deeplearning4j.

the class InMemoryStatsStorage method putStaticInfo.

@Override
public void putStaticInfo(Persistable staticInfo) {
    List<StatsStorageEvent> sses = checkStorageEvents(staticInfo);
    if (!sessionIDs.contains(staticInfo.getSessionID())) {
        sessionIDs.add(staticInfo.getSessionID());
    }
    SessionTypeWorkerId id = new SessionTypeWorkerId(staticInfo.getSessionID(), staticInfo.getTypeID(), staticInfo.getWorkerID());
    this.staticInfo.put(id, staticInfo);
    StatsStorageEvent sse = null;
    if (listeners.size() > 0)
        sse = new StatsStorageEvent(this, StatsStorageListener.EventType.PostStaticInfo, staticInfo.getSessionID(), staticInfo.getTypeID(), staticInfo.getWorkerID(), staticInfo.getTimeStamp());
    for (StatsStorageListener l : listeners) {
        l.notify(sse);
    }
    notifyListeners(sses);
}
Also used : StatsStorageEvent(org.deeplearning4j.api.storage.StatsStorageEvent) StatsStorageListener(org.deeplearning4j.api.storage.StatsStorageListener)

Example 4 with StatsStorageListener

use of org.deeplearning4j.api.storage.StatsStorageListener in project deeplearning4j by deeplearning4j.

the class PlayUIServer method attach.

@Override
public synchronized void attach(StatsStorage statsStorage) {
    if (statsStorage == null)
        throw new IllegalArgumentException("StatsStorage cannot be null");
    if (statsStorageInstances.contains(statsStorage))
        return;
    StatsStorageListener listener = new QueueStatsStorageListener(eventQueue);
    listeners.add(new Pair<>(statsStorage, listener));
    statsStorage.registerStatsStorageListener(listener);
    statsStorageInstances.add(statsStorage);
    for (UIModule uiModule : uiModules) {
        uiModule.onAttach(statsStorage);
    }
    log.info("StatsStorage instance attached to UI: {}", statsStorage);
}
Also used : QueueStatsStorageListener(org.deeplearning4j.ui.storage.impl.QueueStatsStorageListener) UIModule(org.deeplearning4j.ui.api.UIModule) QueuePairStatsStorageListener(org.deeplearning4j.ui.storage.impl.QueuePairStatsStorageListener) StatsStorageListener(org.deeplearning4j.api.storage.StatsStorageListener) QueueStatsStorageListener(org.deeplearning4j.ui.storage.impl.QueueStatsStorageListener)

Example 5 with StatsStorageListener

use of org.deeplearning4j.api.storage.StatsStorageListener in project deeplearning4j by deeplearning4j.

the class InMemoryStatsStorage method putUpdate.

@Override
public void putUpdate(Persistable update) {
    List<StatsStorageEvent> sses = checkStorageEvents(update);
    Map<Long, Persistable> updateMap = getUpdateMap(update.getSessionID(), update.getTypeID(), update.getWorkerID(), true);
    updateMap.put(update.getTimeStamp(), update);
    StatsStorageEvent sse = null;
    if (listeners.size() > 0)
        sse = new StatsStorageEvent(this, StatsStorageListener.EventType.PostUpdate, update.getSessionID(), update.getTypeID(), update.getWorkerID(), update.getTimeStamp());
    for (StatsStorageListener l : listeners) {
        l.notify(sse);
    }
    notifyListeners(sses);
}
Also used : Persistable(org.deeplearning4j.api.storage.Persistable) StatsStorageEvent(org.deeplearning4j.api.storage.StatsStorageEvent) StatsStorageListener(org.deeplearning4j.api.storage.StatsStorageListener)

Aggregations

StatsStorageListener (org.deeplearning4j.api.storage.StatsStorageListener)5 StatsStorageEvent (org.deeplearning4j.api.storage.StatsStorageEvent)3 UIModule (org.deeplearning4j.ui.api.UIModule)2 QueuePairStatsStorageListener (org.deeplearning4j.ui.storage.impl.QueuePairStatsStorageListener)2 QueueStatsStorageListener (org.deeplearning4j.ui.storage.impl.QueueStatsStorageListener)2 Persistable (org.deeplearning4j.api.storage.Persistable)1 StatsStorage (org.deeplearning4j.api.storage.StatsStorage)1 InMemoryStatsStorage (org.deeplearning4j.ui.storage.InMemoryStatsStorage)1