Skip to Content.
Sympa Menu

opal - Re: [Opal] Monitor output: Text file busy

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

Re: [Opal] Monitor output: Text file busy


Chronological Thread 
  • From: "Snuverink Jochem (PSI)" <jochem.snuverink AT psi.ch>
  • To: "Dr. Simon Friederich" <s.friederich AT uni-mainz.de>, "Adelmann Andreas (PSI)" <andreas.adelmann AT psi.ch>
  • Cc: "opal AT lists.psi.ch" <opal AT lists.psi.ch>
  • Subject: Re: [Opal] Monitor output: Text file busy
  • Date: Thu, 30 Apr 2020 07:12:14 +0000
  • Accept-language: en-US, de-CH

Dear Simon,


The difference in behaviour between the different h5 files, is because they are treated slightly different internally in OPAL: if the Monitor file already exists it is deleted at initialisation (which triggers the error message in your case), while the main h5 file is not (since it might be appended to depending on your input file).


In pyOPALTools internally we read the files with h5py, I don't think we can have a "with open" approach with it.

However, there exists an environment variable HDF5_USE_FILE_LOCKING that can be set to FALSE (export HDF5_USE_FILE_LOCKING=FALSE). I don't know if that will help in your case (I haven't tested).

If not, then easiest would be to find a different working setup. I would suggest to copy the data at the end of an OPAL run to another directory first, and read from that directory.
You can include this copying at the end of your opal input file, e.g.:

SYSTEM, "cp -r . ../readdir";

Hope that helps,
Jochem


From: opal-request AT lists.psi.ch <opal-request AT lists.psi.ch> on behalf of Adelmann Andreas (PSI) <andreas.adelmann AT psi.ch>
Sent: Wednesday, April 29, 2020 2:00 PM
To: Dr. Simon Friederich
Cc: opal AT lists.psi.ch
Subject: Re: [Opal] Monitor output: Text file busy
 
Dear Simon the 

mon1.h5 is closed when the OPAL simulation is terminating. 

It seams that while the mon1.h5 is open for write, you can not
read (file busy). If this is a bug or a feature is hard to say however to me it
sound logically that while a binary file is open one should not
try to read. 

I hope that helps.

Cheers A
------
Dr. sc. math. Andreas (Andy) Adelmann
Head a.i. Labor for Scientific Computing and Modelling 
Paul Scherrer Institut OHSA/ CH-5232 Villigen PSI
Phone Office: xx41 56 310 42 33 Fax: xx41 56 310 31 91
Zoom ID: 470-582-4086
-------------------------------------------------------
Friday: ETH HPK G 28   +41 44 633 3076
============================================
The more exotic, the more abstract the knowledge, 
the more profound will be its consequences.
Leon Lederman 
============================================

On 29 Apr 2020, at 13:20, Dr. Simon Friederich <s.friederich AT uni-mainz.de> wrote:

Dear OPAL-Team,

I use pyOPALTools in the following way (example.h5 = global .h5-file including all phase space information, mon1.h5 = monitor output):

    from opal.opal import load_dataset

    h5file = load_dataset(".", fname="example.h5")
    mon1 = load_dataset(".", fname="mon1.h5")

Which works perfectly well.

Problem:
While having these commands executed in an interactive python shell or application, the OPAL terminal prints:

Error>     boost::filesystem::remove: Text file busy: "mon1.h5"

if I want to rerun the simulation simultanously.

Of course I understand what the error wants to tell me, but what I don't understand is, why does the global h5-file not lead to the error (or vice versa: why does the monitor output; both are of the same filetype after being instanciated). And following up: Can you tell me how to circumvent the locking. The "with open()"-like aproach "with load_dataset(...) as f: tmp = f" which normaly is used in such cases does not work due to an AttributError arising.

Thank you very much.

Best regards,

Simon

-- 
-----------------------------------
Dr. Simon Friederich
Helmholtz-Institut Mainz
Kollaboration B/ACID
Johannes Gutenberg-Universität Mainz
Staudingerweg 18
55128 Mainz, Deutschland

Tel.: +49 (0)6131 39-23160
E-Mail: s.friederich AT uni-mainz.de
-----------------------------------




Archive powered by MHonArc 2.6.19.

Top of Page