-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to use h5l_create_external #272
Comments
When external links are traversed, they are always opened with That said, I still think this may represent a weakness in import h5py
import os
source_file = h5py.File(os.tmpnam(),"w")
target_file = h5py.File(os.tmpnam(),"w")
tfname = target_file.filename
target_group = target_file.require_group("target_group")
target_file.close()
source_file["ext_link"] = h5py.ExternalLink(tfname, "target_group")
group = source_file.require_group("ext_link/new_group")
group["abc"]="abc"
group["1"]=1
group["1.1"]=1.1
source_file.close()
target_file = h5py.File(tfname,"r")
assert(target_file["target_group"]["new_group"]["abc"].value == "abc")
assert(target_file["target_group"]["new_group"]["1"].value == 1)
assert(target_file["target_group"]["new_group"]["1.1"].value == 1.1)
def close(self):
""" Close the file. All open objects become invalid """
with phil:
# We have to explicitly murder all open objects related to the file
# Close file-resident objects first, then the files.
# Otherwise we get errors in MPI mode.
id_list = h5f.get_obj_ids(self.id, ~h5f.OBJ_FILE)
file_list = h5f.get_obj_ids(self.id, h5f.OBJ_FILE)
id_list = [x for x in id_list if h5i.get_file_id(x).id == self.id.id]
file_list = [x for x in file_list if h5i.get_file_id(x).id == self.id.id]
for id_ in id_list:
while id_.valid:
h5i.dec_ref(id_)
for id_ in file_list:
while id_.valid:
h5i.dec_ref(id_)
self.id.close() Link to docs noting use of |
I'm working on a patch to provide a julia API for creating external (soft) links via H5L_create_external. I have a working example, but I'm having a hard time writing a test for it. I create a link from
source_file["ext_link"]
totarget_file["target_group"]
then add a few entries to that group. I want to opentarget_file
and check that the entries have the correct values, but I get an error saying "file close degree doesn't match". I'm guessing I want something like "close hard" but I don't know where to look.I close and restart julia, I can open
target_file
and see that it has the correct items.Details below
In plain.jl I replace line 1974 with (I don't think H5L_create_hard_external exists)
Then I run the following
And get this error
The text was updated successfully, but these errors were encountered: