Class SimulationMonitor
java.lang.Object
java.lang.Thread
fr.ifremer.isisfish.simulator.launcher.SimulationMonitor
- All Implemented Interfaces:
Runnable
Moniteur singleton pour pouvoir sauvegarder localement la liste des
simulations démarrées et permettre de continuer le monitoring au
relancemenent d'Isis.
Depuis la version 3.3, elle sauvegarde en plus les zip pour pouvoir
relancer une simulation même si isis a été arreté entre temps.
Cette classe n'implemente pas
SimulationServiceListener
car elle ne doit pas écouter toutes les simulations, mais
seulement celle dit simple, c'est-à-dire "master plan" du plan
d'analyse.
Il faut bien faire attention lors du relancement des simulations a copier
le zip a un autre endroit. Il est important d'avoir deux zip car celui
de la sauvegarde est supprimé des que la simulation est arrete.- Since:
- 3.2.0.4
- Version:
- $Revision$ Last update : $Date$ By : $Author$
- Author:
- chatellier
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TimerCheck scheduler.protected SortedSet<AbstractMap.SimpleEntry<Date,SimulationJob>> Map to remember when a simulation have to be checked.protected static SimulationMonitorInstance.protected FileSimulation information saving file.protected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidanalyzeSensitivityResult(SimulationJob job, SimulationStorage simulation) For each finished simulation, check that all sensitivity simulation are available (in case of sensitivity simulation only).protected booleancheckProgression(SimulationJob job, SimulatorLauncher launcher) Check progression.protected voiddoPostSimulationOperation(SimulationJob job, SimulatorLauncher launcher) Operation to do after simulation end.static SimulationMonitorInstance getter.protected intgetNumberOfFinishedSimulation(String asPrefixName, int numberOfSimulation) Parcourt le dossier de toutes les simulation commencant par le prefix donné, et retourne le nombre de simulation terminées.protected List<SimulationStorage>getStorageListForSecondPass(String asPrefixName, int numberOfSimulation) Parcourt les dossiers et instancie les storages une fois qu'on est sur qu'on a toutes les simulations.voidreloadConfig(SimulationService service) Reload config and read non simulation job into simulation service.protected voidrestartSimulation(SimulationService service, File simulationFolder, String simulationId, Properties propertiesFile) Restart a single simulation.protected voidTake all simulation in loaded file.voidrun()voidSave simulation informations for started simulations.voidMark a simulation as stopped.protected voidWait a little time, and check for first simulation progression, if first simulation time is reached.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
PROPERTIES_FILE
- See Also:
-
PROPERTY_LAUNCHER
- See Also:
-
PROPERTY_DATE
- See Also:
-
PROPERTY_ZIP
- See Also:
-
PROPERTY_STANDALONE
- See Also:
-
PROPERTY_LASTSIMULATION
- See Also:
-
instance
Instance. -
monitorFolder
Simulation information saving file. -
checkSet
Map to remember when a simulation have to be checked. Sorted on date ASC. -
checkScheduler
Check scheduler.
-
-
Constructor Details
-
SimulationMonitor
protected SimulationMonitor()Constructeur.
-
-
Method Details
-
getInstance
Instance getter.- Returns:
- instance
-
reloadConfig
Reload config and read non simulation job into simulation service.- Parameters:
service- SimulationService
-
restartSimulationProgression
Take all simulation in loaded file. And add it into simulation service. -
restartSimulation
protected void restartSimulation(SimulationService service, File simulationFolder, String simulationId, Properties propertiesFile) throws IOException Restart a single simulation.- Parameters:
service- simulation servicesimulationFolder- simulation information foldersimulationId- simulation idpropertiesFile- simulation properties file- Throws:
IOException
-
simulationStart
Save simulation informations for started simulations.- Parameters:
job- started job
-
simulationStop
Mark a simulation as stopped. Remove it from save file.- Parameters:
job- job that control the simulation
-
run
public void run() -
waitAndCheckProgression
protected void waitAndCheckProgression()Wait a little time, and check for first simulation progression, if first simulation time is reached. -
checkProgression
Check progression.- Parameters:
job- job to check progressionlauncher- SimulatorLauncher that manage simulation- Returns:
trueis simulation is finished,falseotherwise
-
doPostSimulationOperation
Operation to do after simulation end.- get simulation result
- do registred post actions
- do sensitivity analisys second pass
- Parameters:
job- joblauncher-SimulatorLauncherthat manage simulation
-
analyzeSensitivityResult
For each finished simulation, check that all sensitivity simulation are available (in case of sensitivity simulation only).- Parameters:
job- jobsimulation- simulation
-
getNumberOfFinishedSimulation
Parcourt le dossier de toutes les simulation commencant par le prefix donné, et retourne le nombre de simulation terminées.- Parameters:
asPrefixName- simulation name (without number suffix)numberOfSimulation- total simulation number- Returns:
- le nombre de simulation réellement terminée
-
getStorageListForSecondPass
protected List<SimulationStorage> getStorageListForSecondPass(String asPrefixName, int numberOfSimulation) Parcourt les dossiers et instancie les storages une fois qu'on est sur qu'on a toutes les simulations.- Parameters:
asPrefixName- simulation name (without number suffix)numberOfSimulation- total simulation number- Returns:
- la liste des storages
-