Renting CPU time for a Python script
Terry Reedy
tjreedy at udel.edu
Sat Jul 20 12:07:57 EDT 2002
"Jeremy Fincher" <tweedgeezer at hotmail.com> wrote in message
news:698f09f8.0207192212.76272194 at posting.google.com...
> Fernando Pérez <fperez528 at yahoo.com> wrote in message
news:<ah9k4o$259$1 at peabody.colorado.edu>...
> > 1- code in automatic checkpointing and self-restarting abilities.
It's fairly
> > easy to do, and saves a lot of headaches.
>
> Do you know of any examples of this in available code, or could you
> outline how you would implement something like that? I have a
project
> right now that such a capability would come quite useful in, but
> rather than hazard my own implementation right off, I'd like to try
> and leverage some other efforts.
Details are project specific, but here is outline.
Assume outer loop of long-running program takes 5 minutes. At bottom
of loop, write out enough data to restart program. If proccessing
multigigabyte file, this might be a simple as writing f.tell() and
using f.seek() on restart. For more typical program states, leverage
with (c)pickle to write and read.
If outer loop takes, say 3 seconds, one might add counter to save
after each 100 loops.
If outer loop takes, say, a day, look for inner loop save point (but
restarting will be harder).
Hope this helps.
Terry J. Reedy
More information about the Python-list
mailing list