Skip to content

Commit

Permalink
added test to check the correct collection of failed runs from Ensemb…
Browse files Browse the repository at this point in the history
…leModel
  • Loading branch information
alfoa committed Sep 22, 2017
1 parent 93fbcfd commit cfa6e32
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
from scipy.integrate import odeint
import copy
import time

###################################################################################################################
# #
# THIS MODEL WILL ALWAYS FAIL (IT IS USED TO CHECK THE COLLECTION OF FAILED RUNS FROM THE ENSEMBLE MODEL) #
# #
###################################################################################################################

def run(self, Input):
raise RuntimeError("EXPECTED FAILURE")

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" ?>
<Simulation verbosity="debug">
<TestInfo>
<name>framework/ensembleModelTests.testEnsembleModelLinearExpectedFailure</name>
<author>alfoa</author>
<created>2017-09-22</created>
<classesTested>Models.EnsembleModel, Models.ExternalModel, JobHandler.Thread</classesTested>
<description>
Mechanic TEST: This test is aimed to check that the failures from the EnsembleModel are correctly collected without abnormal
termination of RAVEN.
</description>
</TestInfo>
<RunInfo>
<WorkingDir>metaModelLinearExpectedFailure</WorkingDir>
<Sequence>failStep</Sequence>
<batchSize>2</batchSize>
<internalParallel>False</internalParallel>
</RunInfo>

<Distributions>
<Uniform name="leftTemperatureDist">
<lowerBound>500</lowerBound>
<upperBound>1700</upperBound>
</Uniform>
<Uniform name="rightTemperatureDist">
<lowerBound>500</lowerBound>
<upperBound>1700</upperBound>
</Uniform>
</Distributions>

<Models>
<!-- EM1faulty will allways fail -->
<ExternalModel ModuleToLoad="metaModelLinearExpectedFailure/EM1faulty" name="heatTransfer" subType="">
<variables>leftTemperature,rightTemperature,k,solution</variables>
</ExternalModel>
<ExternalModel ModuleToLoad="EM2linear" name="thermalConductivityComputation" subType="">
<variables>leftTemperature,rightTemperature,k,averageTemperature</variables>
</ExternalModel>
<EnsembleModel name="heatTransferEnsembleModel" subType="">
<Model class="Models" type="ExternalModel">
thermalConductivityComputation
<Input class="DataObjects" type="PointSet">inputHolder</Input>
<TargetEvaluation class="DataObjects" type="PointSet">thermalConductivityComputationContainer</TargetEvaluation>
</Model>
<Model class="Models" type="ExternalModel">
heatTransfer
<Input class="DataObjects" type="PointSet">inputHolder</Input>
<TargetEvaluation class="DataObjects" type="PointSet">heatTransferContainer</TargetEvaluation>
</Model>
</EnsembleModel>
</Models>

<Samplers>
<Grid name="myGrid">
<variable name="leftTemperature">
<distribution>leftTemperatureDist</distribution>
<grid construction="equal" steps="2" type="value">500 600</grid>
</variable>
<variable name="rightTemperature">
<distribution>rightTemperatureDist</distribution>
<grid construction="equal" steps="2" type="value">500 600</grid>
</variable>
</Grid>
</Samplers>

<Steps>
<MultiRun name="failStep" repeatFailureRuns="3">
<Input class="DataObjects" type="PointSet">inputHolder</Input>
<Model class="Models" type="EnsembleModel">heatTransferEnsembleModel</Model>
<Sampler class="Samplers" type="Grid">myGrid</Sampler>
<Output class="DataObjects" type="PointSet">metaModelOutputTest</Output>
<Output class="DataObjects" type="PointSet">thermalConductivityComputationContainer</Output>
<Output class="DataObjects" type="PointSet">heatTransferContainer</Output>
</MultiRun>
</Steps>


<DataObjects>
<PointSet name="inputHolder">
<Input>leftTemperature,rightTemperature</Input>
<Output>OutputPlaceHolder</Output>
</PointSet>
<PointSet name="heatTransferContainer">
<Input>leftTemperature,rightTemperature,k</Input>
<Output>solution</Output>
</PointSet>
<PointSet name="thermalConductivityComputationContainer">
<Input>leftTemperature,rightTemperature</Input>
<Output>k</Output>
</PointSet>
<PointSet name="metaModelOutputTest">
<Input>leftTemperature,rightTemperature</Input>
<Output>k,solution</Output>
</PointSet>
</DataObjects>

</Simulation>
6 changes: 6 additions & 0 deletions tests/framework/ensembleModelTests/tests
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,10 @@
rel_err=1.e-4
[../]

[./testEnsembleModelLinearExpectedFailure]
type = 'RavenErrors'
input = 'test_ensemble_model_linear_expected_failures.xml'
expect_err = 'IOError: There were failed runs; aborting RAVEN.'
[../]

[]

0 comments on commit cfa6e32

Please sign in to comment.