[R] Simulations in R during power failure

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Sun Aug 27 09:31:50 CEST 2006


On 27-Aug-06 mel wrote:
> bbvaughn at bellsouth.net a écrit :
> 
>> Hi everyone,
>> I recently ran a simulation on a computer using R that was hooked up
>> to a UPS.  There was one time when the power was out for length and
>> the computer shut down.  I was worried that I had lost the simulation,
>> but upon booting the machine up, I heard the processor kick in.

I'm not sure what you meant by "heard the processor kick in"!
If you really were rebooting, then everything would start from scratch
anyway.

Most UPS's can be connected with a cable -- serial or network -- to the
computer so as to cause the computer to shut-down cleanly, or execute
some other procedure, once the UPS has been standing-in for the mains
for a certain length of time and is about to shut itself down.

So one things that may have happened is that when all programs were
cleanly shut down in this way, R (if configured to automatically
save its state when being closed down in ".Rdata" etc -- see comment
about save.image() below and also see "?quit") would have been in a
position to resume when re-started.

Another possibility (depending on UPS and hardware configuration)
is that when the mains power had been off for a certain length of time
the UPS communicated with the computer to put it into "stand-by",
with the current state being swapped out to disk; the computer would
then draw minimum power from the UPS, which in turn would be able to
remain active for a much longer duration. Then, when power came back on,
the UPS would tell the computer to "resume". However, I doubt this
would be able to cope with a power outage of several days such as
might ensue from a hurricane!

However, all this is just guesses. You need to find out what has been
configured for that comnputer and UPS.

In any case, whenever there is a serious risk of power interruptions,
Mel's advice below is the way to go! Though simply writing tables
to disk my not be sufficient. If you really want to be able to resume
where you left off, then use the function save.image() whose options
and description can be found under "?save".

>> It sounded like the simulation had resumed.
>> Does anyone have any experience with this?  Because I live in Florida
>> and there is a possibility of another hurricane.  And I am running a
>> huge simulation which may or may not finish before this hurricane
>> finishes.
>> What options are there in saving a simulation and it picking up where
>> it left off?
>> Thanks,
>> Brandon
> 
> write your results, let's say every hour or 30' on your disk.
> something like
> if (substr(date(),...)=='30') write.table(...)
> where it could take place
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 27-Aug-06                                       Time: 08:31:44
------------------------------ XFMail ------------------------------



More information about the R-help mailing list