restartSpades | R Documentation |
This is very experimental and has not been thoroughly tested. Use with caution.
This function will re-parse a single module (currently) into the simList
where its source code should reside, and then optionally restart a simulation
that stopped on an error, presumably after the developer has modified the
source code of the module that caused the break.
This will restart the simulation at the next event in the event queue
(i.e., returned by events(sim)
). Because of this, this function will
not do anything if the event queue is empty.
restartSpades(sim = NULL, module = NULL, numEvents = Inf, restart = TRUE, ...)
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). In the |
restart |
Logical. If |
... |
Passed to |
This will only parse the source code from the named module. It will not affect any
objects that are in the mod
or sim
.
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
.
This will only work reliably
if the simList
was not modified yet during the event which caused the error.
The simList
will be in the state it was at the time of the error.
# 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
s <- restartSpades(s) # don't need to specify `sim` if previous line fails
# will take from savedSimEnv()$.sim automatically
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.