Perhaps there is the possibility for bad things to happen if you kill-9 the process. I will look at the python docs for what the signal handling behavior of the atexit callbacks is.

Maybe this is a reason to run flush() at the end of each report? You kind of kill the caching I would think, but it might be safer.

Sent from my iPhone

On Apr 16, 2013, at 10:50 AM, kyleabeauchamp <notifications@github.com> wrote:

> In MDTraj/reporters/hdf5reporter.py:
> 
> > +    https://www.pytables.org/moin/UserDocuments/AtexitHooks"""
> > +    open_files = tables.file._open_files
> > +    are_open_files = len(open_files) > 0
> > +    if verbose and are_open_files:
> > +        print >> sys.stderr, "Closing remaining open files:",
> > +    for fileh in open_files.keys():
> > +        if verbose:
> > +            print >> sys.stderr, "%s..." % (open_files[fileh].filename,),
> > +        open_files[fileh].close()
> > +        if verbose:
> > +            print >> sys.stderr, "done",
> > +    if verbose and are_open_files:
> > +        print >> sys.stderr
> > +
> > +
> > +atexit.register(close_open_files, False)
> I wonder if it's useful to have verbose be the default. PyTables files can get corrupted pretty easily. I think one easy path towards corruption is trying to have two processes write the same database.
> 
> Printing this message should help remind users when file handles are still open.
> 
> —
> Reply to this email directly or view it on GitHub.