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

RAVEN running RAVEN in Python or Jupyter Notebook Workflows #1816

Merged
merged 6 commits into from
Apr 25, 2022
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
86 changes: 23 additions & 63 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,79 +1,39 @@
.failed_tests
.libs
.ravenrc
*-dbg
*-devel
*-oprof
*-opt
*.a
*.csv
*.ctf
*.d
*.dylib
*.e
*.la
*.lo
*.d
*.o
*.a
*-opt
*-dbg
*-oprof
*-devel
*.e
*.csv
*.ravencntr
*.ravenStatus
*.so
*~
*.ctf
tests/core_example/PWR_CoreChannel_controlled_var_restart_test_out_restart_0020.ravenaux
tests/core_example/PWR_CoreChannel_controlled_var_test_out_restart_0020.ravenaux
*.ravencntr
control_modules/distribution1D.py
control_modules/distribution1D_wrap.cxx
control_modules/raventools.py
control_modules/raventools_wrap.cxx
control_modules/libdistribution1D.so*
control_modules/libdistribution1D.so*
control_modules/libraventools.so*
control_modules/libraventools.so*
libRAVEN*.so*
RAVEN-devel
tests/framework/DataBaseStorage/
tests/framework/GridTestBison/CustomSampler/
tests/framework/GridTestRaven/FirstMRun/
tests/framework/LHStestBison/myLHS/
tests/framework/LHStestRaven/FirstMRun/
tests/framework/MCTestBison/CustomSampler/
tests/framework/MCTestBison/CustomSampler_noalias/
tests/framework/branch/DETrunTest/
tests/framework/SBO_DET/DET/
tests/framework/mode_test/FirstMRun/
tests/framework/output_check/*.png
tests/framework/output_check/FirstMRun/
tests/framework/revirD_tset/FirstMRun/
tests/framework/test_extract_data_s_from_hdf5/MonteCarlo/
tests/framework/test_rom_trainer/MC_for_rom_trainer/
tests/framework/mpi_driver_test/FirstMRun/
tests/framework/CodeInterfaceTests/MelcorInterface/testMelcor/*
tests/framework/CodeInterfaceTests/RELAP5interfaceTestSingleRun/*
work_in_progress/remote_tools/remote_tools
work_in_progress/remote_tools/remote_tools.py
work_in_progress/remote_tools/remote_tools_wrap.cxx
work_in_progress/remote_tools/time
framework/DatabaseStorage/
tests/framework/LHStestFerret/myLHS/
tests/framework/PreconditionedDynamicEventTree/PreconditionedDETrunTest/
tests/framework/CUBIT_MOOSE_test/grid_run/
tests/framework/BISON_and_MESH_test/grid_run/
tests/framework/RedundantInputs/sim_py_MC/
tests/framework/RedundantInputs/sim_py_grid/
tests/plugins
plugins/ExamplePlugin/doc/version.tex
build_out*
build/
.failed_tests
.ravenrc
*.ravenStatus
install/
src/crow_modules/distribution1D.py
libRAVEN*.so*
plugins/ExamplePlugin/doc/version.tex
raven_cxx.egg-info/
raven_framework.egg-info/
raven_framework*.whl
src/contrib/amsc.egg-info/
src/crow_modules/distribution1D_wrap.cpp
src/crow_modules/interpolationND.py
src/crow_modules/distribution1D.py
src/crow_modules/interpolationND_wrap.cpp
src/crow_modules/randomENG.py
src/crow_modules/interpolationND.py
src/crow_modules/randomENG_wrap.cpp
build_out*
src/crow_modules/randomENG.py
test_out*
framework/contrib/PythonFMU/pythonfmu.egg-info/
raven_framework.egg-info/
raven_framework*.whl

# eclipse
.project
Expand Down
19 changes: 9 additions & 10 deletions ravenframework/CodeInterfaces/RAVEN/RAVENInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RAVEN(CodeInterfaceBase):
"""
def __init__(self):
CodeInterfaceBase.__init__(self)
self.preCommand = "" # this is the precommand (bash.exe in case of win)
self.preCommand = "python " # this is the precommand
self.printTag = 'RAVEN INTERFACE'
self.outputPrefix = 'out~'
self.outStreamsNamesAndType = {} # Outstreams names and type {'outStreamName':[DataObjectName,DataObjectType]}
Expand All @@ -43,7 +43,7 @@ def __init__(self):
# 'noscalar' = True if convertNotScalarSampledVariables exists in extModForVarsManipulation module
# 'scalar' = True if manipulateScalarSampledVariables exists in extModForVarsManipulation module
self.hasMethods = {'noscalar':False, 'scalar':False}
# inner workind directory
# inner working directory
self.innerWorkingDir = ''
# linked DataObjects and Databases
self.linkedDataObjectOutStreamsNames = None
Expand Down Expand Up @@ -72,7 +72,7 @@ def _readMoreXML(self, xmlNode):
@ Out, None.
"""
baseName = os.path.basename(xmlNode.find("executable").text)
if baseName not in ['raven_framework','Driver.py']:
if baseName not in ['raven_framework','raven_framework.py']:
raise IOError(self.printTag+' ERROR: executable must be "raven_framework" (in whatever location)! Got "'+baseName+'"!')

linkedDataObjects = xmlNode.find("outputExportOutStreams")
Expand Down Expand Up @@ -169,11 +169,13 @@ def generateCommand(self,inputFiles,executable,clargs=None,fargs=None, preExec=N
index = self.__findInputFile(inputFiles)
outputfile = self.outputPrefix+inputFiles[index].getBase()
# we set the command type to serial since the SLAVE RAVEN handles the parallel on its own
pre = ""
if "python" not in executable.lower() or not executable.endswith(".py"):
pre = self.preCommand.strip() + " "
executeCommand = [('serial',pre + executable+ ' '+inputFiles[index].getFilename())]
# executable command will be: "python <path>/raven_framework.py"
# make sure executable ends with .py
if not executable.endswith(".py"):
executable += ".py"
executeCommand = [('serial', self.preCommand + executable+ ' ' + inputFiles[index].getFilename())]
returnCommand = executeCommand, outputfile

return returnCommand

def initialize(self, runInfo, oriInputFiles):
Expand Down Expand Up @@ -219,9 +221,6 @@ def initialize(self, runInfo, oriInputFiles):
self.variableGroups = varGroupNames
# get inner working dir
self.innerWorkingDir = parser.workingDir
# check operating system and define prefix if needed
if platform.startswith("win") and utils.which("bash.exe") is not None:
self.preCommand = 'bash.exe'

def createNewInput(self, currentInputFiles, oriInputFiles, samplerType, **Kwargs):
"""
Expand Down
Loading