Package esys :: Package escript :: Module modelframe :: Class RestartManager
[hide private]
[frames] | no frames]

Class RestartManager

object --+
         |
        RestartManager

A restart manager which does two things: it decides when restart files were created (when doDump returns true) and manages directories for restart files. The method getNewDumper creates a new directory and returns its name.

This restart manager will decide to dump restart files every dump_step calls of doDump or if more than dump_time since the last dump has elapsed. The restart manager controls two directories for dumping restart data, namely for the current and previous dump. This way the previous dump can be used for restart in the case the current dump failed.

Instance Methods [hide private]
 
__init__(self, dump_time=1080.0, dump_step=None, dumper=None)
Initializes the RestartManager.
 
__saveMarker(self)
 
doDump(self)
Returns true if the restart should be dumped.
 
getCurrentDumper(self)
Returns the name of the currently used dumper.
 
getNewDumper(self)
Creates a new directory to be used for dumping and returns its name.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  D = 8640.0
unit of days, for instance 5*RestartManager.D defines 5 days
  H = 360.0
unit of hours, for instance 5*RestartManager.H defines 5 hours
  MIN = 60.0
unit of minutes, for instance 5*RestartManager.MIN defines 5 minutes
  SEC = 1.0
unit of seconds, for instance 5*RestartManager.SEC defines 5 seconds
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dump_time=1080.0, dump_step=None, dumper=None)
(Constructor)

 

Initializes the RestartManager.

Parameters:
  • dump_time - defines the minimum time interval in SEC between two dumps. If None, time is not used as criterion.
  • dump_step - defines the number of calls of doDump between two dump events. If None, the call counter is not used as criterion.
  • dumper - defines the directory for dumping restart files. Additionally, the directories dumper+"_bkp" and dumper+"_bkp2" are used. If the directory does not exist it is created. If dumper is not present a unique directory within the current working directory is used.
Overrides: object.__init__

doDump(self)

 

Returns true if the restart should be dumped. Use getNewDumper to retrieve the directory name to be used for dumping.