Commit d305ba80 authored by Wout De Nolf's avatar Wout De Nolf

[writer] scan group no longer external

parent 866d01ff
Pipeline #19775 passed with stages
in 35 minutes and 7 seconds
......@@ -72,11 +72,13 @@ class ReferenceProxy(BaseProxy):
"""
for uri in newuris:
linkname = nexus.splitUri(uri)[1].split("/")[-1]
nexus.createLink(group, linkname, uri)
if linkname not in group:
nexus.createLink(group, linkname, uri)
return len(newuris)
def _create(self, nxroot):
"""
Create the group which will contain the links
"""
nxroot.create_group(self.path)
grp = nxroot.create_group(self.path)
grp.attrs["NX_class"] = "NXcollection"
......@@ -1286,6 +1286,9 @@ class NexusScanWriterBase(base_subscriber.BaseSubscriber):
# how many references to expect.
# scan_shape = self.scan_shape(subscan)
# nreferences = dataset_proxy.shape_to_size(scan_shape)
#
# If we want links to scans in /x.y/dependencies(@NXcollection):
# parent = "/" + self._nxentry_name(subscan) + "/dependencies"
rproxy = reference_proxy.ReferenceProxy(
filename=self.filename,
parent="/",
......
......@@ -60,20 +60,12 @@ def scan_filenames(scan, config=True):
:returns list(str):
"""
info = scan_info(scan)
lst = []
if config:
try:
lst = list(info["nexuswriter"]["filenames"])
return list(info["nexuswriter"]["filenames"])
except KeyError:
pass
if not lst:
lst = [filename_int2ext(info["filename"])]
if is_scan_group(scan) and lst[0]:
dirname, filename = os.path.split(lst[0])
filename, ext = os.path.splitext(filename)
filename += ".{}".format(info["scan_nb"])
lst[0] = os.path.join(dirname, filename + ext)
return lst
return [filename_int2ext(info["filename"])]
def session_filenames(scan_saving=None, config=True):
......
......@@ -149,6 +149,7 @@ def stress_many_parallel(test_session, filename, titles, checkoutput=True):
# Group the scans
g = Group(*scns)
g.wait_all_subscans(timeout=10)
scns.append(g.scan)
if checkoutput:
check_output(scns, titles)
......
......@@ -157,7 +157,8 @@ def validate_scangroup_data(sequence, config=True, **kwargs):
"""
# Validate NXentry links
validate_master_links(sequence.scan, config=config)
validate_scangroup_links(sequence, config=config)
# Validate scan links (currently disabled)
# validate_scangroup_links(sequence, config=config)
# Validate NXentry content
uri = scan_utils.scan_uri(sequence.scan, config=config)
with nexus.uriContext(uri) as nxentry:
......@@ -192,10 +193,9 @@ def validate_scangroup_links(sequence, config=True):
for scan in sequence._scans:
expected += scan_utils.scan_uris(scan, config=config)
uri = scan_utils.scan_uri(sequence.scan, config=config)
expected.append(uri)
actual = []
with nexus.uriContext(uri) as nxentry:
root = nxentry.parent
root = nxentry["dependencies"]
for k in root:
actual.append(nexus.normUri(nexus.dereference(root[k])))
assert_set_equal(set(actual), set(expected))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment