Skip to content
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: 43 additions & 43 deletions Analyzing_Regression_Tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"metadata": {},
"outputs": [],
"source": [
"version_info = regression_analysis.test_os_cli('/home/julien/Software/Others/OS-build-release/Products/openstudio')\n",
"version_info = regression_analysis.test_os_cli('/Users/julien/Software/Others/OS-build-release3/Products/openstudio')\n",
"# version_info = regression_analysis.test_os_cli('openstudio')"
]
},
Expand Down Expand Up @@ -177,7 +177,7 @@
"# Force a new version (don't want to be prompted each time I parse df_files)\n",
"new_version = compat_matrix.iloc[0].copy()\n",
"new_version['OpenStudio'] = version\n",
"new_version['E+'] = \"24.2.0\"\n",
"new_version['E+'] = \"25.1.0\"\n",
"new_version['SHA'] = sha\n",
"new_version['Released'] = 'TBD'\n",
"new_version['Has_Docker'] = False\n",
Expand Down Expand Up @@ -353,7 +353,13 @@
"metadata": {},
"outputs": [],
"source": [
"df_files = regression_analysis.find_info_osws(compat_matrix=compat_matrix, testtype='model')"
"def filter_max_eplus_versions(df_files: pd.DataFrame, max_eplus_versions: int = 3) -> pd.DataFrame:\n",
" df_files = df_files[sorted(df_files.columns, key=lambda x: packaging.version.parse(x[0]))]\n",
" df_files = df_files[\n",
" df_files.columns.get_level_values(level='E+')\n",
" .unique()[-max_eplus_versions:]\n",
" ]\n",
" return df_files"
]
},
{
Expand All @@ -362,28 +368,26 @@
"metadata": {},
"outputs": [],
"source": [
"# Limit to most recent versions so to no clutter display\n",
"df_files = df_files[['23.1.0', '23.2.0', '24.1.0']]\n",
"#df_files = df_files[['9.4.0', '9.5.0']]"
"df_files = regression_analysis.find_info_osws(compat_matrix=compat_matrix, testtype='model')"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"## With custom Tags"
"# Limit to most recent versions so to no clutter display\\n\",\n",
"# df_files = df_files[['23.1.0', '23.2.0', '24.1.0', '24.2.0', '25.1.0']]\n",
"df_files = filter_max_eplus_versions(df_files=df_files, max_eplus_versions=3)\n",
"df_files"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"df_files = regression_analysis.find_info_osws_with_tags(compat_matrix=compat_matrix,\n",
" # Switch to True/False\n",
" tags_only=False,\n",
" testtype='model')"
"## With custom Tags"
]
},
{
Expand Down Expand Up @@ -415,7 +419,17 @@
" else:\n",
" if space_tag != 'WithSpaces':\n",
" cols.append(col)\n",
" return df_files[cols]"
" return df_files[cols]\n",
"\n",
"def fill_space_tag(df_files: pd.DataFrame) -> pd.DataFrame:\n",
" new_cols = [] \n",
" for ep_version, os_version, tag in df_files.columns.tolist():\n",
" if not tag:\n",
" v = version.parse(os_version)\n",
" tag = 'WithSpaces' if v >= version.parse(SPACE_DEFAULTED_TO_ON) else 'WithoutSpaces'\n",
" new_cols.append((ep_version, os_version, tag))\n",
" df_files.columns = pd.MultiIndex.from_tuples(new_cols, names=df_files.columns.names)\n",
" return df_files"
]
},
{
Expand All @@ -424,27 +438,10 @@
"metadata": {},
"outputs": [],
"source": [
"# WithSpaces\n",
"# df_files = filter_on_space_enabled(df_files, True)\n",
"\n",
"# WithoutSpaces\n",
"df_files = filter_on_space_enabled(df_files, False)"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"# Limit to most recent versions so to no clutter display\n",
"df_files = df_files[[\n",
" #'9.2.0', '9.3.0', \n",
" #'9.4.0',\n",
" #'9.5.0',\n",
" #'9.6.0'\n",
" '22.1.0',\n",
" '22.2.0',\n",
" '23.1.0',\n",
"]]"
"df_files = regression_analysis.find_info_osws_with_tags(compat_matrix=compat_matrix,\n",
" # Switch to True/False\n",
" tags_only=False,\n",
" testtype='model')"
]
},
{
Expand All @@ -453,11 +450,14 @@
"metadata": {},
"outputs": [],
"source": [
"max_eplus_versions = 3\n",
"df_files = df_files[\n",
" df_files.columns.get_level_values(level='E+')\n",
" .unique()[-max_eplus_versions:]\n",
" ]"
"# WithSpaces\n",
"# df_files = filter_on_space_enabled(df_files, True)\n",
"\n",
"# WithoutSpaces\n",
"# df_files = filter_on_space_enabled(df_files, False)\n",
"\n",
"# Or just fill it up\n",
"df_files = fill_space_tag(df_files)"
]
},
{
Expand All @@ -466,7 +466,7 @@
"metadata": {},
"outputs": [],
"source": [
"df_files.columns.tolist()"
"df_files = filter_max_eplus_versions(df_files=df_files, max_eplus_versions=3)"
]
},
{
Expand Down
4 changes: 4 additions & 0 deletions SDD_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,10 @@ def test_FT_solar_collector_integralcollectorstorage
sdd_ft_test('solar_collector_integralcollectorstorage.osm')
end

def test_FT_space_level_dsoa
sdd_ft_test('space_level_dsoa.osm')
end

def test_FT_space_load_instances
sdd_ft_test('space_load_instances.osm')
end
Expand Down
11 changes: 8 additions & 3 deletions highlevel_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def test_osms_are_defined_sim_tests
missing_osms = all_model_filenames - osms_in_sim_test

# These are the OSMS we expect NOT to find in a sim_test
expected_sim_missing = []
expected_sim_missing = [
# Unusual structure
'space_level_dsoa.osm'
]
missing_osms -= expected_sim_missing

assert missing_osms.empty?, "Error in model_tests.rb: The following OSMs are not in any sim_tests:\n * #{missing_osms.join("\n * ")}"
Expand All @@ -48,7 +51,8 @@ def test_rbs_are_defined_sim_tests
'autosize_hvac.rb',
# This one has an unusual structure, and I don't feel like playing with the
# regex above any more
'outputcontrol_files.rb'
'outputcontrol_files.rb',
'space_level_dsoa.rb'
]

missing_rbs -= expected_sim_missing
Expand All @@ -68,7 +72,8 @@ def test_pys_are_defined_sim_tests
missing_pys = all_python_filenames - pys_in_sim_test

expected_sim_missing = [
'outputcontrol_files.py'
'outputcontrol_files.py',
'space_level_dsoa.py'
]
missing_pys -= expected_sim_missing

Expand Down
37 changes: 29 additions & 8 deletions launch_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,36 @@
# Source the file that has the colors
source colors.sh

unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Darwin;;
CYGWIN*|MINGW*|MSYS*) machine=Windows;;
*) machine="UNKNOWN:${unameOut}"
esac

if [[ "$(arch)" == "arm64" ]]; then
platform="--platform linux/amd64"
fi

#######################################################################################
# H A R D C O D E D A R G U M E N T S
########################################################################################

# All versions you want to run
# 2.0.4 is supported, but it's very broken, transition to 2.0.5 is likely going to just fail, so remove it
declare -a all_versions=("2.0.5" "2.1.0" "2.1.1" "2.1.2" "2.2.0" "2.2.1" "2.2.2" "2.3.0" "2.3.1" "2.4.0" "2.4.1" "2.5.0" "2.5.1" "2.5.2" "2.6.0" "2.6.1" "2.7.0" "2.7.1" "2.8.0" "2.8.1" "2.9.0" "2.9.1" "3.0.0" "3.0.1" "3.1.0" "3.2.0" "3.2.1" "3.3.0" "3.4.0" "3.5.0" "3.5.1")
declare -a all_versions=(
"2.0.5" "2.1.0" "2.1.1" "2.1.2" "2.2.0" "2.2.1" "2.2.2" "2.3.0" "2.3.1" "2.4.0" "2.4.1" "2.5.0"
"2.5.1" "2.5.2" "2.6.0" "2.6.1" "2.7.0" "2.7.1" "2.8.0" "2.8.1" "2.9.0" "2.9.1"
"3.0.0" "3.0.1" "3.1.0" "3.2.0" "3.2.1" "3.3.0" "3.4.0" "3.5.0" "3.5.1" "3.6.0" "3.6.1" "3.7.0" "3.8.0" "3.9.0"
)

# declare -a all_versions=("3.0.0" "3.0.1" "3.1.0")

#for os_version in "${all_versions[@]}"; do
# /Applications/OpenStudio-${os_version}/bin/openstudio model_tests.rb -n /space_level_dsoa/
#done

# Do you want to ask the user to set these arguments?
# If false, will just use the hardcoded ones
ask_user=true
Expand All @@ -28,7 +49,7 @@ force_rebuild=false
test_file="model_tests.rb"

# Test filter: passed as model_tests -n /$filter/
filter=""
filter="space_level_dsoa"
# Run only osms tests: filter="_osm"

# Delete custom/openstudio:$os_version image after having used it?
Expand Down Expand Up @@ -238,13 +259,13 @@ for os_version in "${all_versions[@]}"; do
# If the docker image doesn't already exists
if [ -z $(docker images -q $os_image_name) ]; then
echo -e "* Building the $os_image_str from Dockerfile"
docker build -t $os_image_name .
docker build $platform -t $os_image_name .
else
if [ "$force_rebuild" = true ];
then
echo -e "* Rebuilding the image $os_image_str from Dockerfile"
docker rmi $os_image_name > $OUT
docker build -t $os_image_name .
docker build $platform -t $os_image_name .
fi
echo
fi
Expand All @@ -260,9 +281,9 @@ for os_version in "${all_versions[@]}"; do
echo -e "* Launching the $os_container_str"
if [ "$use_mongo" = true ]; then
# Launch, with link to the mongo one
docker run --name $os_container_name --cpus="$n_cores" --link $mongo_container_name:mongo -v `pwd`/test:/root/test -d -it --rm $os_image_name /bin/bash > $OUT
docker run $platform --name $os_container_name --cpus="$n_cores" --link $mongo_container_name:mongo -v `pwd`/test:/var/simdata/openstudio/OpenStudio-resources/test -d -it --rm $os_image_name /bin/bash > $OUT
else
docker run --name $os_container_name --cpus="$n_cores" -v `pwd`/test:/root/test -d -it --rm $os_image_name /bin/bash > $OUT
docker run $platform --name $os_container_name --cpus="$n_cores" -v `pwd`/test:/var/simdata/openstudio/OpenStudio-resources/test -d -it --rm $os_image_name /bin/bash > $OUT
fi

# Chmod execute the script
Expand Down Expand Up @@ -312,8 +333,8 @@ for os_version in "${all_versions[@]}"; do

done

# On other systems than windows, fix permissions
if [[ "$(uname)" != MINGW* ]]; then
# On other Linux only, fix permissions
if [[ $machine == Linux ]]; then
echo
echo -e "${On_Blue}Fixing ownership: setting it to user=$USER and chmod=664 (requires sudo)${Color_Off}"
sudo chown -R $USER *
Expand Down
44 changes: 27 additions & 17 deletions launch_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ source colors.sh
# Switch this to true to debug.
verbose=false

unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Darwin;;
CYGWIN*|MINGW*|MSYS*) machine=Windows;;
*) machine="UNKNOWN:${unameOut}"
esac

if [[ "$(arch)" == "arm64" ]]; then
platform="--platform linux/amd64"
fi

########################################################################################

# Verbosity
Expand All @@ -31,9 +43,9 @@ if [[ "$(uname)" = MINGW* ]]; then
fi
docker()
{
export MSYS_NO_PATHCONV=1
("docker.exe" "$@")
export MSYS_NO_PATHCONV=0
export MSYS_NO_PATHCONV=1
("docker.exe" "$@")
export MSYS_NO_PATHCONV=0
}
fi

Expand Down Expand Up @@ -231,11 +243,11 @@ function cleanup() {
stop_running_container "$mongo_container_name" "$mongo_container_str" N


if [[ "$(uname)" != MINGW* ]]; then
echo
echo -e "${On_Blue}Fixing ownership: setting it to user=$USER and chmod=664 (requires sudo)${Color_Off}"
sudo chown -R $USER *
sudo find ./test/ -type f -exec chmod 664 {} \;
if [[ $machine == Linux ]]; then
echo
echo -e "${On_Blue}Fixing ownership: setting it to user=$USER and chmod=664 (requires sudo)${Color_Off}"
sudo chown -R $USER:$USER ./test/
sudo find ./test/ -type f -exec chmod 664 {} \;
fi

exit $1
Expand Down Expand Up @@ -326,7 +338,7 @@ if [ -z $(docker images -q $os_image_name) ]; then
fi

echo -e "* Building the $os_image_str from Dockerfile"
docker build -t $os_image_name .
docker build $platform -t $os_image_name .

else
echo -e "The docker $os_image_str already exists"
Expand All @@ -337,7 +349,7 @@ else
then
echo -e "* Rebuilding the image $os_image_str from Dockerfile"
docker rmi $os_image_name > $OUT
docker build -t $os_image_name .
docker build $platform -t $os_image_name .
fi
echo
fi
Expand All @@ -355,9 +367,10 @@ fi
echo -e "* Launching the $os_container_str"
if [ "$use_mongo" = true ]; then
# Launch, with link to the mongo one
docker run --name $os_container_name --link $mongo_container_name:mongo -v `pwd`/test:/root/test -d -it --rm $os_image_name /bin/bash > $OUT
docker run $platform --name $os_container_name --link $mongo_container_name:mongo -v `pwd`/test:/var/simdata/openstudio/OpenStudio-resources -d -it --rm $os_image_name /bin/bash > $OUT
else
docker run --name $os_container_name -v `pwd`/test:/root/test -d -it --rm $os_image_name /bin/bash > $OUT
# docker run $platform --name $os_container_name -v `pwd`/test:/root/test -d -it --rm $os_image_name /bin/bash > $OUT
docker run $platform --name $os_container_name -v `pwd`/test:/var/simdata/openstudio/OpenStudio-resources/test -d -it --rm $os_image_name /bin/bash > $OUT
fi

# Chmod execute the script
Expand Down Expand Up @@ -400,16 +413,13 @@ echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Nn]$ ]]
then
if [[ "$(uname)" = MINGW* ]]; then
winpty docker attach $os_container_name
winpty docker attach $os_container_name
else
docker attach $os_container_name
docker attach $os_container_name
fi
fi



# Run cleanup when normal execution
cleanup 0



Loading
Loading