public interface StatsStorage extends StatsStorageRouter
Key design ideas:
(a) Two types of storable objects:
i. Persistable objects, for once per session objects ("static info") and also for periodically reported data ("updates")
ii. StorageMetaData objects, for
(b) There are 4 types of things used to uniquely identify these Persistable objects:
i. SessionID: A unique identifier for a single session
ii. TypeID: A unique identifier for the listener or type of data
For example, we might have stats from 2 (or more) listeners with identical session and worker IDs
This is typically hard-coded, per listener class
iii. WorkerID: A unique identifier for workers, within a session
iv. Timestamp: time at which the record was created
For example, single machine training (with 1 listener) would have 1 session ID, 1 type ID, 1 worker ID, and multiple timestamps.
Distributed training multiple listeres could have 1 session ID, multiple type IDs, and multiple worker IDs, and multiple timestamps for each
A hyperparameter optimization job could have multiple session IDs on top of that.
Note that the StatsStorage interface extends StatsStorageRouter
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close any open resources (files, etc)
|
void |
deregisterStatsStorageListener(StatsStorageListener listener)
Remove the specified listener, if it is present.
|
List<Persistable> |
getAllStaticInfos(String sessionID,
String typeID)
Get all static informations for the given session and type ID
|
List<Persistable> |
getAllUpdatesAfter(String sessionID,
String typeID,
long timestamp)
Get all updates for the given session ID (all worker IDs), that occur after (not including) the given timestamp.
|
List<Persistable> |
getAllUpdatesAfter(String sessionID,
String typeID,
String workerID,
long timestamp)
Get all updates for the given session and worker ID, that occur after (not including) the given timestamp.
|
long[] |
getAllUpdateTimes(String sessionID,
String typeID,
String workerID)
List the times of all updates for the specified sessionID, typeID and workerID
|
Persistable |
getLatestUpdate(String sessionID,
String typeID,
String workerID)
Get the latest update record (i.e., update record with the largest timestamp value) for the specified
session and worker IDs
|
List<Persistable> |
getLatestUpdateAllWorkers(String sessionID,
String typeID)
Get the latest update for all workers, for the given session ID
|
List<StatsStorageListener> |
getListeners()
Get a list (shallow copy) of all listeners currently present
|
int |
getNumUpdateRecordsFor(String sessionID)
Return the number of update records for the given session ID (all workers)
|
int |
getNumUpdateRecordsFor(String sessionID,
String typeID,
String workerID)
Return the number of update records for the given session ID and worker ID
|
Persistable |
getStaticInfo(String sessionID,
String typeID,
String workerID)
Get the static info for the given session and worker IDs, or null if no such static info has been reported
|
StorageMetaData |
getStorageMetaData(String sessionID,
String typeID)
Get the session metadata, if any has been registered via
StatsStorageRouter.putStorageMetaData(StorageMetaData) |
Persistable |
getUpdate(String sessionID,
String typeId,
String workerID,
long timestamp)
Get the specified update (or null, if none exists for the given session/worker ids and timestamp)
|
List<Persistable> |
getUpdates(String sessionID,
String typeID,
String workerID,
long[] timestamps)
Get updates for the specified times only
|
boolean |
isClosed() |
List<String> |
listSessionIDs()
Get a list of all sessions stored by this storage backend
|
List<String> |
listTypeIDsForSession(String sessionID)
Get the list of type IDs for the given session ID
|
List<String> |
listWorkerIDsForSession(String sessionID)
For a given session ID, list all of the known worker IDs
|
List<String> |
listWorkerIDsForSessionAndType(String sessionID,
String typeID)
For a given session ID and type ID, list all of the known worker IDs
|
void |
registerStatsStorageListener(StatsStorageListener listener)
Add a new StatsStorageListener.
|
void |
removeAllListeners()
Remove all listeners from the StatsStorage instance
|
boolean |
sessionExists(String sessionID)
Check if the specified session ID exists or not
|
putStaticInfo, putStaticInfo, putStorageMetaData, putStorageMetaData, putUpdate, putUpdatevoid close()
throws IOException
IOExceptionboolean isClosed()
List<String> listSessionIDs()
boolean sessionExists(String sessionID)
sessionID - Session ID to checkPersistable getStaticInfo(String sessionID, String typeID, String workerID)
sessionID - Session IDworkerID - worker IDList<Persistable> getAllStaticInfos(String sessionID, String typeID)
sessionID - Session ID to get static info fortypeID - Type ID to get static info forList<String> listTypeIDsForSession(String sessionID)
sessionID - Session ID to queryList<String> listWorkerIDsForSession(String sessionID)
sessionID - Session IDList<String> listWorkerIDsForSessionAndType(String sessionID, String typeID)
sessionID - Session IDtypeID - Type IDint getNumUpdateRecordsFor(String sessionID)
sessionID - Session IDint getNumUpdateRecordsFor(String sessionID, String typeID, String workerID)
sessionID - Session IDworkerID - Worker IDPersistable getLatestUpdate(String sessionID, String typeID, String workerID)
sessionID - session IDworkerID - worker IDPersistable getUpdate(String sessionID, String typeId, String workerID, long timestamp)
sessionID - Session IDworkerID - Worker IDtimestamp - TimestampList<Persistable> getLatestUpdateAllWorkers(String sessionID, String typeID)
sessionID - Session IDList<Persistable> getAllUpdatesAfter(String sessionID, String typeID, String workerID, long timestamp)
sessionID - Session IDworkerID - Worker Idtimestamp - TimestampList<Persistable> getAllUpdatesAfter(String sessionID, String typeID, long timestamp)
sessionID - Session IDtimestamp - Timestamplong[] getAllUpdateTimes(String sessionID, String typeID, String workerID)
sessionID - Session ID to get update times fortypeID - Type ID to get update times forworkerID - Worker ID to get update times forList<Persistable> getUpdates(String sessionID, String typeID, String workerID, long[] timestamps)
sessionID - Session ID to get update times fortypeID - Type ID to get update times forworkerID - Worker ID to get update times fortimestamps - Timestamps to get the updates for. Note that if one of the specified times does not exist,
it will be ommitted from the returned results list.StorageMetaData getStorageMetaData(String sessionID, String typeID)
StatsStorageRouter.putStorageMetaData(StorageMetaData)sessionID - Session ID to get metadatvoid registerStatsStorageListener(StatsStorageListener listener)
listener - Listener to addvoid deregisterStatsStorageListener(StatsStorageListener listener)
listener - Listener to removevoid removeAllListeners()
List<StatsStorageListener> getListeners()
Copyright © 2019. All rights reserved.