| restartSpades | R Documentation |
This is experimental and has not been thoroughly tested. Use with caution.
If there is an error during an event, this function will rewind the simulation to a state
numEvents prior to the event that led to the error. The developer may then modify the
source code of the module that caused the break and resume the simulation.
restartSpades(
sim = NULL,
module = NULL,
numEvents = Inf,
restart = TRUE,
verbose = getOption("reproducible.verbose", 1L),
...
)
saveState(filename, ...)
restartOrSimInitAndSpades(ll, file, reset = getOption("spades.resetRestart"))
sim |
A |
module |
A character string length one naming the module that caused the error and
whose source code was fixed. This module will be re-parsed and placed into the |
numEvents |
Numeric. Default is Inf (i.e., all available).
The number of events to be rewound.
In the |
restart |
Logical. If |
verbose |
Logical or Numeric, follows |
... |
Passed to |
filename |
The filename to save the sim state.
|
ll |
A list of elements that would be passed to |
file |
An optional file that has a saved |
reset |
Logical. If |
If options('spades.recoveryMode') is set to TRUE or a numeric (default 1), then
there will be a list in the simList called .recoverableObjs.
These record the elements of simList that have changed over a number of events equal
to the number chosen for options('spades.recoveryMode').
The restartSpades function then uses this list to rewind numEvents backwards from the
first event in events(sim) (likely the one that caused the error).
The random number seed will be reset to the state it was at the start of the earliest event recovered, thereby returning to the exact stochastic simulation trajectory.
A simList as if spades had been called on a simList.
A simList, that has been "executed" until end(sim), if it does not
hit an error.
The simList will be in the state it was numEvents prior to the event
that led to the error (although some objects, e.g., on disk, may have already been modified).
# options("spades.recoveryMode" = 1) # now the default
s <- simInit()
s <- spades(s) # if this is interrupted or fails
## the following line will not work if the previous line didn't fail:
## don't need to specify `sim` if previous line fails;
## will take from savedSimEnv()$.sim automatically
s <- restartSpades(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.