Skip to content
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

Alfoa/issue780 ls #781

Merged
merged 8 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion framework/h5py_interface_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ def addGroup(self,rlz):
@ Out, None
"""
parentID = rlz.get("RAVEN_parentID",[None])[0]
groupName = str(rlz.get("prefix")[0] if not isinstance(rlz.get("prefix"),basestring) else rlz.get("prefix"))
prefix = rlz.get("prefix")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue in #780 complains that rlz is None, the changes here did not reflect this. Could you explain it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. The issue reports a failure in the following line:

groupName = str(rlz.get("prefix")[0] if not isinstance(rlz.get("prefix"),basestring) else rlz.get("prefix"))

The reason was that since some of the adaptive samplers/optimizers construct a solution export DataObject without a prefix for each realization, the rlz.get("prefix") was returning None (not found keyword "prefix"). Now since the old machine was either expecting the prefix to be a string (basestring) or a list, it was falling in the "not string case" so trying to access to rlz.get("prefix")[0] but the ruturn case was not a string not because it was a list but because it was None.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks.

if prefix is not None:
groupName = str(prefix[0] if not isinstance(prefix,basestring) else prefix)
else:
# this can happen when we want to add sampler generated data (e.g. LimitSurface) in the database
groupName = str(len(self.allGroupPaths))
if parentID:
#If Hierarchical structure, firstly add the root group
if not self.firstRootGroup or parentID == "None":
Expand Down
23 changes: 19 additions & 4 deletions tests/framework/PostProcessors/LimitSurface/test_LimitSurface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<name>framework/PostProcessors/LimitSurface.testLimitSurfacePostProcessor</name>
<author>alfoa</author>
<created>2014-07-10</created>
<classesTested>Models.PostProcessors.LimitSurface, Functions.External</classesTested>
<classesTested>Models.PostProcessors.LimitSurface, Functions.External, Databases.HDF5</classesTested>
<description>
This test is aimed to check the capability of RAVEN to generate Limit Surfaces from a pre-generated data set (in this case, generated with
a MonteCarlo sampling), outputting the generated Limit Surface in DataObject.PointSet(s) reporting both transition boundaries (-1 1) or just
a MonteCarlo sampling), outputting the generated Limit Surface in DataObject.PointSet(s) and Databases.HDF5 reporting both transition boundaries (-1 1) or just
one of them.
</description>
<revisions>
Expand All @@ -24,12 +24,19 @@
<revision author="alfoa" date="2017-12-14">
Moved LimitSurface Postprocessor tests in a specific directory (tests/framework/PostProcessors/LimitSurface) and updated for new DataObject structure
</revision>
<revision author="alfoa" date="2018-09-11"> Added an additional IOStep to check that the limit surface DataObject can be dumped into a Database of type HDF5</revision>
</revisions>
<requirements>R-RA-1</requirements>
</TestInfo>
<RunInfo>
<WorkingDir>limitSurface</WorkingDir>
<Sequence>FirstMRun,ComputeLimitSurfacePositive,ComputeLimitSurfaceNegative,ComputeLimitSurfacePositiveNegative</Sequence>
<Sequence>
FirstMRun,
ComputeLimitSurfacePositive,
ComputeLimitSurfaceNegative,
ComputeLimitSurfacePositiveNegative,
dumpLimitSurfacePositiveNegativeInHDF5
</Sequence>
<batchSize>1</batchSize>
</RunInfo>

Expand Down Expand Up @@ -134,8 +141,16 @@
<Output class="DataObjects" type="PointSet">LimitSurfacePositiveNegative</Output>
<Output class="OutStreams" type="Print">LimitSurfacePositiveNegative_dump</Output>
</PostProcess>
<IOStep name="dumpLimitSurfacePositiveNegativeInHDF5">
<Input class="DataObjects" type="PointSet">LimitSurfacePositiveNegative</Input>
<Output class="Databases" type="HDF5">test_db_database</Output>
</IOStep>
</Steps>


<Databases>
<HDF5 name="test_db_database" readMode="overwrite"/>
</Databases>

<OutStreams>
<Print name="PointSetPostProcTest_dump">
<type>csv</type>
Expand Down