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);
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations