Skip to content

Commit 5f5832b

Browse files
authored
GitHub actions (#2538)
* add github action for linux * fix syntax issue * add github action test machie macos and windows * fix a couple of errors, and add numba which is required by statsforecast, but the version is incompatible * fix one more error * pin the version for numba and remove always in github action since it will continue run if new push is made * downgrade ubuntu to 22 and revert numba * swith statsforecast from conda to pip * update tests for SyntheticHistory * pin statsforecast to 1.7 * unpin scipy * pin scipy to 1.9.1 * update mac * revert changes for gold file in Basic TSA test * revert changes for scipy * testing conda to install statsforecast * use pip to install statsforecast instead of conda * update gitattribute * ignore hpp for github language detection * update dependencies * update scipy * update conda check * add conda path in Git Action machine * fix syntax error * add print for python path * for some reason, read_ravenrc is not workingx * fix syntax error * add python command * revert change in establish_conda_env.sh * resolve type error in Linux * update conda path in github action Windows machine * update github action * force python to 3.11 for linux * disable plugins for linux test * test python 3.11 for linux * flex python in Linux * switch to pip * pin numba to 0.61 to avoid coverage issue * update test max time and rel err * pin typing-extension to 4.14 for ray issue * typo * disable grpcio * include max_time for ray external test * regold DiffARMA * enable plugins testing * update tests rel err * diable FARM due to issue of quadprog lib, and change batch from 4 to 3 for ray * remove HERON LOGOS and DOVE from testing due to pyomo conflicts * pin python to 3.11 for mac * pin grpcio due to the issue with ray, ray has issue with grpcio >1.71 * unpin ray 2.38 * pin ray to 2.49 and remove typing-extension * add notes for dependencies * pin typing-extension and skip ExternalModelRay test * add a couple of github machines * enable to test all the plugins except FARM * disable HERON and DOVE due to pyomo conflicts
1 parent 91f29e9 commit 5f5832b

File tree

13 files changed

+628
-140
lines changed

13 files changed

+628
-140
lines changed

.github/workflows/github-actions.yml

Lines changed: 454 additions & 0 deletions
Large diffs are not rendered by default.

dependencies.xml

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,43 @@ Note all install methods after "main" take
3535
3636
end reading flow
3737
-->
38+
39+
<!--
40+
1. ray can be updated to 2.51, however for mac test machine, only 2.49 is installed. In addition,
41+
ray have conflicts with grpcio, which sometime we need to pin the version of grpcio
42+
2. ray may also have issue with typing-extensions, which sometime we need to pin the version
43+
3. few libraries need to be updated in the near future, such as numpy, scikit-learn, scipy
44+
4. some libraries in plugins can cause library conflicts, such as FARM quadprog which can really
45+
limit our library choices.
46+
-->
47+
3848
<dependencies>
3949
<main>
40-
<h5py/>
41-
<numpy>1.26</numpy>
50+
<h5py source="pip"/>
51+
<numpy source="pip">1.26</numpy>
4252
<!-- pip installs were overwritting the scipy version, so using pip -->
4353
<scipy source="pip">1.12</scipy>
44-
<scikit-learn>1.1</scikit-learn>
45-
<pandas/>
54+
<scikit-learn source="pip">1.1</scikit-learn>
55+
<!-- Pin numba to 0.61 to avoid coverage issue: https://github.com/numba/numba/issues/10239 -->
56+
<numba source="pip">0.61</numba>
57+
<pandas source="pip"/>
4658
<!-- Note most versions of xarray work, but some (such as 0.20) don't -->
47-
<xarray/>
59+
<xarray source="pip"/>
4860
<netcdf4 source="pip">1.6</netcdf4>
49-
<matplotlib>3.6</matplotlib>
50-
<statsmodels>0.13</statsmodels>
51-
<cloudpickle/>
61+
<matplotlib source="pip">3.6</matplotlib>
62+
<statsmodels source="pip">0.13</statsmodels>
63+
<cloudpickle source="pip"/>
5264
<tensorflow source="pip">2.14</tensorflow>
53-
<grpcio source="pip" />
65+
<!-- <grpcio source="pip">1.69</grpcio> -->
5466
<!-- conda is really slow on windows if the version is not specified.-->
5567
<python skip_check='True' os='windows'>3.11</python>
56-
<python skip_check='True' os='mac,linux'>3</python>
68+
<python skip_check='True' os='linux'>3</python>
69+
<python skip_check='True' os='mac'>3.11</python>
5770
<hdf5 skip_check='True'/>
5871
<swig skip_check='True'/>
5972
<pylint/>
6073
<coverage/>
61-
<lxml/>
74+
<lxml source="pip"/>
6275
<psutil/>
6376
<pip/>
6477
<pyDOE3 source="pip"/>
@@ -67,14 +80,17 @@ Note all install methods after "main" take
6780
<nomkl os='linux' skip_check='True'/>
6881
<cmake skip_check='True' optional='True'/>
6982
<dask source="pip" pip_extra="[complete]"/>
70-
<ray source="pip" pip_extra="[default]">2.38</ray>
83+
<!-- Pin typing-extensions to resolve some import issue in ray -->
84+
<typing-extensions source="pip">4.14</typing-extensions>
85+
<ray source="pip" pip_extra="[default]">2.49</ray>
7186
<!-- redis is needed by ray, but on windows, this seems to need to be explicitly stated -->
7287
<redis source="pip" os='windows'/>
7388
<imageio source="pip">2.22</imageio>
7489
<line_profiler optional='True'/>
7590
<!-- <ete3 optional='True'/> -->
76-
<statsforecast/>
77-
<pywavelets>1.4</pywavelets>
91+
<!-- <statsforecast source='pip'/> -->
92+
<statsforecast source="pip"/>
93+
<pywavelets source="pip">1.4</pywavelets>
7894
<python-sensors source="pip"/>
7995
<numdifftools source="pip">0.9</numdifftools>
8096
<fmpy optional='True'/>
@@ -84,7 +100,7 @@ Note all install methods after "main" take
84100
<ipopt skip_check='True' optional='True'/>
85101
<cyipopt optional='True'/>
86102
<pyomo-extensions source="pyomo" skip_check='True' optional='True'/>
87-
<setuptools />
103+
<setuptools source="pip"/>
88104
<!-- source="mamba" are the ones installed when mamba is installed -->
89105
<mamba source='mamba' skip_check='True'/>
90106
<pydmd source="pip"/>

ravenframework/CodeInterfaceClasses/OpenFOAM/OpenFOAMoutputParser.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
_AVAILABLE_FILE_TYPES = ['functionObjectProperties', 'volScalarField', 'volVectorField','surfaceScalarField', 'surfaceVectorField']
3636

37-
def checkAccessAndWaitIfStillAccessed(filename: str | pathlib.Path, gracePeriod: float = 1., timeout: float =100.):
37+
def checkAccessAndWaitIfStillAccessed(filename: Union[str, pathlib.Path], gracePeriod: float = 1., timeout: float =100.):
3838
"""
3939
This utility method is aimed to check the timestamp of last access of the file
4040
and wait (up to timeout+gracePeriod) if it is within the gracePeriod
@@ -66,8 +66,8 @@ class openfoamOutputParser(object):
6666
Class to parse different openFOAM output files
6767
"""
6868
def __init__(self,
69-
caseDirectory: str | pathlib.Path,
70-
caseFileName: str | pathlib.Path,
69+
caseDirectory: Union[str,pathlib.Path],
70+
caseFileName: Union[str,pathlib.Path],
7171
variables: List[str] = None, writeCentroids: bool = False,
7272
checkAccessAndWait: bool = False):
7373
"""
@@ -218,7 +218,7 @@ def _expandVariablesFromVectorToScalar(data):
218218
newData[var] = data[var]
219219
return newData
220220

221-
def _readCumulativeContErr(self, path: str | pathlib.Path) -> Tuple[List[int], Union[float, list]]:
221+
def _readCumulativeContErr(self, path: Union[str,pathlib.Path]) -> Tuple[List[int], Union[float, list]]:
222222
"""
223223
Method to read the cumulativeContErr file
224224
@ In, path, str | Path, Path to the OpenFOAM file (e.g. '0.1/uniform/cumulativeContErr').
@@ -282,7 +282,7 @@ def _functionObjectPropertiesParseDict(self, path: pathlib.Path) -> Dict[str, ob
282282
out[key] = vec
283283
return out
284284

285-
def uniformFolderAggregate(self, caseDir: str | pathlib.Path) -> Tuple[np.ndarray, Dict[str, np.ndarray]]:
285+
def uniformFolderAggregate(self, caseDir: Union[str,pathlib.Path]) -> Tuple[np.ndarray, Dict[str, np.ndarray]]:
286286
"""
287287
Method to walk the case, read every time directory's functionObjectProperties and cumulativeContErr (if present)
288288
and collect the values into time-sorted NumPy arrays.
@@ -376,7 +376,7 @@ def _collect(self, foamfile: pathlib.Path,
376376
return times, np.stack(values), centroids
377377

378378
def aggregateFieldNumpy(self, field: str = "U",
379-
foamCasefile: str | None = None
379+
foamCasefile: Union[str, None] = None
380380
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
381381
"""
382382
Aggregate 'field' over every available time step.

run_tests

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ for A in "$@"; do
5050
esac
5151
done
5252
echo 'Loading libraries ...'
53+
54+
if [[ "$INSTALLATION_MANAGER" != "PIP" ]]
55+
then
56+
INSTALLATION_MANAGER=CONDA
57+
fi
58+
5359
if [[ $SKIP_LOAD_ENV == 1 ]];
5460
then
5561
echo Using currently active python environment, with command $(command -v python)
@@ -58,6 +64,7 @@ elif [[ "$INSTALLATION_MANAGER" == "CONDA" ]];
5864
then
5965
source $SCRIPT_DIR/scripts/establish_conda_env.sh --load
6066
echo Loaded conda environment, with command $(command -v python)
67+
PYTHON_COMMAND=$(command -v python)
6168
elif [[ "$INSTALLATION_MANAGER" == "PIP" ]];
6269
then
6370
source $SCRIPT_DIR/scripts/establish_conda_env.sh --load --installation-manager PIP
@@ -68,6 +75,7 @@ else
6875
then
6976
# check the RC file
7077
PYTHON_COMMAND=$(read_ravenrc "PYTHON_COMMAND")
78+
echo Python Command Debug: $PYTHON_COMMAND
7179
fi
7280
fi
7381

scripts/establish_conda_env.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,18 @@ function find_conda_defs ()
5959
# default location of conda definitions, windows is unsurprisingly an exception
6060
if [[ "$OSOPTION" = "--os windows" ]];
6161
then
62-
if test -e "/c/ProgramData/Miniconda3/etc/profile.d/conda.sh"
63-
then
64-
CONDA_DEFS="/c/ProgramData/Miniconda3/etc/profile.d/conda.sh";
65-
elif test -e "$HOME/AppData/Local/miniconda3/etc/profile.d/conda.sh"
66-
then
67-
CONDA_DEFS="$HOME/AppData/Local/miniconda3/etc/profile.d/conda.sh
68-
"
69-
else
70-
echo Failed to find Conda at /c/ProgramData/Miniconda3/etc/profile.d/conda.sh and $HOME/AppData/Local/miniconda3/etc/profile.d/conda.sh
71-
72-
fi
62+
if test -e "/c/ProgramData/Miniconda3/etc/profile.d/conda.sh"
63+
then
64+
CONDA_DEFS="/c/ProgramData/Miniconda3/etc/profile.d/conda.sh";
65+
elif test -e "$HOME/AppData/Local/miniconda3/etc/profile.d/conda.sh"
66+
then
67+
CONDA_DEFS="$HOME/AppData/Local/miniconda3/etc/profile.d/conda.sh"
68+
elif test -e "/c/Users/runneradmin/miniconda3/etc/profile.d/conda.sh"
69+
then
70+
CONDA_DEFS="/c/Users/runneradmin/miniconda3/etc/profile.d/conda.sh"
71+
else
72+
echo Failed to find Conda at /c/ProgramData/Miniconda3/etc/profile.d/conda.sh and $HOME/AppData/Local/miniconda3/etc/profile.d/conda.sh
73+
fi
7374
elif test -e "$HOME/miniconda3/etc/profile.d/conda.sh";
7475
then
7576
CONDA_DEFS="$HOME/miniconda3/etc/profile.d/conda.sh";

tests/framework/InternalParallelTests/test_internal_parallel_extModelRay.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<RunInfo>
2424
<WorkingDir>InternalParallelExtModelRay</WorkingDir>
2525
<Sequence>ParalleMonteCarlo</Sequence>
26-
<batchSize>4</batchSize>
26+
<batchSize>3</batchSize>
2727
<parallelMethod>ray</parallelMethod>
2828
</RunInfo>
2929

tests/framework/InternalParallelTests/tests

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
type = 'RavenFramework'
1414
input = 'test_internal_parallel_extModelRay.xml'
1515
UnorderedCsv = 'InternalParallelExtModelRay/testPointSet_dump.csv'
16-
skip_if_OS = windows
16+
# skip_if_OS = windows
17+
skip = "random failure, ray issue with typing-extension and grpcio library"
18+
max_time = 500
1719
[../]
1820
[./PostProcessor]
1921
type = 'RavenFramework'

tests/framework/PostProcessors/LimitSurface/tests

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
input = 'test_LimitSurface_and_integral.xml'
1515
output = 'limitSurface_integral/LimitSurfaceUnWeightedPb_dump.xml limitSurface_integral/LimitSurfaceWeightedPb_dump.xml'
1616
csv = 'limitSurface_integral/LimitSurfaceWeightedPb_dump.csv limitSurface_integral/LimitSurfaceUnWeightedPb_dump.csv'
17-
max_time = 300
17+
max_time = 500
1818
rel_err = 0.001
1919
#skip = 'need to be fixed'
2020
[../]
@@ -32,14 +32,14 @@
3232
input = 'test_LimitSurface_with_err_bounds.xml'
3333
output = 'limitSurfaceBoundingError/LimitSurfaceWeightedPb_dump.xml'
3434
max_time = 300
35-
rel_err = 0.001
35+
rel_err = 0.005
3636
# replace skip_if_OS = windows with Windows specific gold file
3737
[./csv]
3838
type = OrderedCSV
3939
output = 'limitSurfaceBoundingError/LimitSurfaceWeightedPb_dump.csv'
4040
windows_gold = 'limitSurfaceBoundingError/WindowsLimitSurfaceWeightedPb_dump.csv'
4141
mac_gold = 'limitSurfaceBoundingError/MacLimitSurfaceWeightedPb_dump.csv'
42-
rel_err = 0.003
42+
rel_err = 0.005
4343
[../]
4444
[../]
4545

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fourier__signal_fa__period2.0__amplitude,ARMA__signal_fa__variance,ARMA__signal_fa__MA__2,ARMA__signal_fa__MA__1,ARMA__signal_a__AR__1,Fourier__signal_fa__period2.0__phase,ARMA__signal_a__variance,Fourier__signal_f__period10.0__amplitude,Fourier__signal_f__period2.0__phase,ARMA__signal_a__MA__2,ARMA__signal_fa__constant,ARMA__signal_fa__AR__1,ARMA__signal_a__MA__0,Fourier__signal_fa__fit_intercept,Fourier__signal_f__fit_intercept,Fourier__signal_f__period10.0__phase,Fourier__signal_fa__period5.0__phase,Fourier__signal_fa__period10.0__amplitude,Fourier__signal_f__period5.0__amplitude,Fourier__signal_fa__period5.0__amplitude,Fourier__signal_f__period5.0__phase,ARMA__signal_fa__AR__0,ARMA__signal_a__MA__1,ARMA__signal_fa__MA__0,Fourier__signal_fa__period10.0__phase,ARMA__signal_a__AR__0,Fourier__signal_f__period2.0__amplitude,ARMA__signal_a__constant
2+
2.27119924552,0.545082802149,-0.0784346169836,0.177036376895,-0.758871353908,-0.165113659694,0.531122354771,4.0,3.50800062309e-15,-0.0764776204887,0.0118581486643,-0.439315188798,-1.14427853933,41.8908824287,42.0,-3.14159265359,0.763083169957,3.6485771704,3.0,3.00629571435,0.785398163397,1.35284007491,0.226235051829,-0.758810272971,-3.08854058527,1.75724084413,2.0,0.00810343993023
3+
2.77834476114,0.277925478839,-0.240259217322,0.418073457847,-0.772077636204,0.00410650639164,0.274702280402,2.0,3.2786106481e-15,-0.239683052249,0.0197562630156,-0.780706487772,-1.09280663591,20.0760911024,20.0,3.14159265359,0.587758626516,2.27417407299,1.0,0.678339437727,0.785398163397,1.77447163616,0.403928679353,-1.11569378557,-3.13023980907,1.76475177792,3.0,0.0180760678735

tests/framework/PostProcessors/TSACharacterizer/tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
output = 'Basic/chz.csv'
88
windows_gold = 'Basic/windowsChz.csv'
99
mac_gold = 'Basic/windowsChz.csv'
10+
# mac_gold = 'Basic/macChz.csv'
1011
rel_err = 1.5e-1 # limited by ARMA__signal_fa__constant
1112
zero_threshold = 1e-12
1213
[../]

0 commit comments

Comments
 (0)