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

feature #1566 Use Python 3.8.6 for automated tests #1710

Merged
merged 26 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e0ca544
changes needed to create v5.0 version of metplus_base docker/conda en…
georgemccabe May 12, 2022
e83221d
Merge branch 'develop' into feature_1566_python_3.8.6
georgemccabe Jun 14, 2022
04fd2f9
update metplotpy conda env to use python 3.8 and new package list, th…
georgemccabe Jun 15, 2022
48525ee
turn on use cases that use metplotpy_env to test new conda env
georgemccabe Jun 15, 2022
6fcd2ba
add .v5 to metplotpy conda env to test that environment
georgemccabe Jun 15, 2022
e777a29
removed cartopy from requirements because cartopy may no longer be ne…
georgemccabe Jun 15, 2022
4aacbdc
changed conda environment used for use case
georgemccabe Jun 15, 2022
de8bd9f
update conda before building environments
georgemccabe Jul 8, 2022
2dc8c88
updated instructions and scripts to build python environments using P…
georgemccabe Jul 8, 2022
46a8b4d
updated conda env to include .v5
georgemccabe Jul 8, 2022
af51cdc
updated automated test logic to use new .v5 Docker images that use Co…
georgemccabe Jul 8, 2022
9fa8a0e
rebuilt gempak and gfdl-tracker docker images to use .v5 extension to…
georgemccabe Jul 8, 2022
989d56d
added note to update OS packages to prevent wget certificate errors
georgemccabe Jul 11, 2022
6ef338e
Merge branch 'develop' into feature_1566_python_3.8.6
georgemccabe Jul 12, 2022
c60640f
renamed variables to be more clear which path they are actually storing
georgemccabe Jul 12, 2022
0ff3b18
Updated logic to no longer handle gempak and gfdl-tracker envs differ…
georgemccabe Jul 12, 2022
8d9c612
updated scripts to create Docker image containing Conda environment f…
georgemccabe Jul 14, 2022
075e16a
merged develop and resolved conflicts
georgemccabe Jul 19, 2022
a1eec84
turn off all use cases, ci-run-all-diff
georgemccabe Jul 19, 2022
f54efb3
turn on use cases that previously failed
georgemccabe Jul 19, 2022
39db7f5
turn off use cases tests that passed
georgemccabe Jul 21, 2022
80cb9a1
turn off all use cases and ci-run-all-diff
georgemccabe Jul 21, 2022
790f91e
Merge branch 'develop' into feature_1566_python_3.8.6
georgemccabe Jul 25, 2022
017c7b3
pull latest changes and resolved conflicts, added missing package fro…
georgemccabe Jul 25, 2022
162b063
Merge branch 'feature_1566_python_3.8.6' of github.com:dtcenter/METpl…
georgemccabe Jul 25, 2022
996ea16
per #1566, added explicit version numbers for each Python package tha…
georgemccabe Jul 25, 2022
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
2 changes: 1 addition & 1 deletion .github/actions/run_tests/Dockerfile.run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG METPLUS_ENV_TAG=metplus_base
ARG METPLUS_ENV_TAG=metplus_base.v5
ARG METPLUS_IMG_TAG=develop

FROM dtcenter/metplus-envs:${METPLUS_ENV_TAG} as env
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/run_tests/Dockerfile.run_cartopy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG METPLUS_ENV_TAG=cycloneplotter
ARG METPLUS_ENV_TAG=cycloneplotter.v5
ARG METPLUS_IMG_TAG=develop

FROM dtcenter/metplus-envs:${METPLUS_ENV_TAG} as env
Expand Down
3 changes: 3 additions & 0 deletions .github/jobs/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# repository used for storing input data for development branches
DOCKERHUB_METPLUS_DATA_DEV = 'dtcenter/metplus-data-dev'

# extension to add to conda environments
VERSION_EXT = '.v5'

def get_data_repo(branch_name):
"""! Branch names that start with main_v or contain only
digits and dots with out without a prefix 'v' will return
Expand Down
10 changes: 5 additions & 5 deletions .github/jobs/get_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import get_use_case_commands

# add internal_tests/use_cases directory to path so the test suite can be found
USE_CASES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
sys.path.insert(0, USE_CASES_DIR)
# add METplus directory to path so the test suite can be found
METPLUS_TOP_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
sys.path.insert(0, METPLUS_TOP_DIR)

from internal_tests.use_cases.metplus_use_case_suite import METplusUseCaseSuite

Expand Down
36 changes: 25 additions & 11 deletions .github/jobs/get_use_case_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
import os

# add METplus directory to sys path so the test suite can be found
USE_CASES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
sys.path.insert(0, USE_CASES_DIR)
METPLUS_TOP_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
sys.path.insert(0, METPLUS_TOP_DIR)

from internal_tests.use_cases.metplus_use_case_suite import METplusUseCaseSuite
from metplus.util.met_util import expand_int_string_to_list
from docker_utils import VERSION_EXT

METPLUS_BASE_ENV = 'metplus_base'

# path to METplus install location in Docker
METPLUS_DOCKER_LOC = '/metplus/METplus'

# name of conda environment used for cases that don't need special env
METPLUS_BASE_ENV = 'metplus_base'

# keywords in requirements list that trigger obtaining METcalcpy and METplotpy
PLOTCALC_KEYWORDS = [
'metplotpy',
Expand All @@ -27,6 +32,12 @@
'weatherregime',
]

# Docker envs that do not use Python so they do not need print conda list
NOT_PYTHON_ENVS = [
'gfdl-tracker',
'gempak',
]

def handle_automation_env(host_name, reqs, work_dir):
# if no env is specified, use metplus base environment
conda_env = METPLUS_BASE_ENV
Expand All @@ -44,12 +55,15 @@ def handle_automation_env(host_name, reqs, work_dir):
return '', 'user_env_vars.MET_PYTHON_EXE=python3'
return '', ''

# add version extension to conda environment name
conda_env_w_ext = f'{conda_env}{VERSION_EXT}'

# start building commands to run before run_metplus.py in Docker
setup_env = 'source /etc/bashrc;'

# add conda bin to beginning of PATH
python_dir = os.path.join('/usr', 'local', 'envs',
conda_env, 'bin')
conda_env_w_ext, 'bin')
python_path = os.path.join(python_dir, 'python3')
setup_env += f' export PATH={python_dir}:$PATH;'

Expand Down Expand Up @@ -92,12 +106,12 @@ def handle_automation_env(host_name, reqs, work_dir):
setup_env += f'export PYTHONPATH={METPLUS_DOCKER_LOC}:$PYTHONPATH;'

# list packages in python environment that will be used
if conda_env != 'gempak':
if conda_env not in NOT_PYTHON_ENVS:
setup_env += (
f'echo Using environment: dtcenter/metplus-envs:{conda_env};'
f'echo cat /usr/local/envs/{conda_env}/environments.yml;'
f'echo Using environment: dtcenter/metplus-envs:{conda_env_w_ext};'
f'echo cat /usr/local/envs/{conda_env_w_ext}/environments.yml;'
f'echo ----------------------------------------;'
f'cat /usr/local/envs/{conda_env}/environments.yml;'
f'cat /usr/local/envs/{conda_env_w_ext}/environments.yml;'
'echo ----------------------------------------;'
)

Expand All @@ -108,7 +122,7 @@ def main(categories, subset_list, work_dir=None,
all_commands = []

if work_dir is None:
work_dir = USE_CASES_DIR
work_dir = METPLUS_TOP_DIR

test_suite = METplusUseCaseSuite()
test_suite.add_use_case_groups(categories, subset_list)
Expand Down
6 changes: 4 additions & 2 deletions .github/jobs/setup_and_run_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import subprocess
import shlex

from docker_utils import VERSION_EXT

ci_dir = os.path.join(os.environ.get('GITHUB_WORKSPACE'), '.github')
sys.path.insert(0, ci_dir)

Expand Down Expand Up @@ -46,12 +48,12 @@
mount_args = ' '.join(volume_mounts)

# command to run inside Docker
cmd = ('/usr/local/envs/diff/bin/python3 '
cmd = (f'/usr/local/envs/diff{VERSION_EXT}/bin/python3 '
f'{GITHUB_WORKSPACE}/{CI_JOBS_DIR}/run_diff_docker.py')

# run inside diff env: mount METplus code and output dir, volumes from output volumes
docker_cmd = (f'docker run -e GITHUB_WORKSPACE {VOLUMES_FROM} '
f'{mount_args} dtcenter/metplus-envs:diff '
f'{mount_args} dtcenter/metplus-envs:diff{VERSION_EXT} '
f'bash -c "{cmd}"')
print(f'RUNNING: {docker_cmd}')
try:
Expand Down
4 changes: 3 additions & 1 deletion .github/jobs/setup_and_run_use_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import get_use_case_commands
import get_data_volumes
from docker_utils import get_branch_name
from docker_utils import get_branch_name, VERSION_EXT

runner_workspace = os.environ.get('RUNNER_WORKSPACE')
github_workspace = os.environ.get('GITHUB_WORKSPACE')
Expand Down Expand Up @@ -70,6 +70,8 @@ def main():
else:
env_tag = 'metplus_base'

env_tag = f'{env_tag}{VERSION_EXT}'

# get Dockerfile to use
dockerfile_name = 'Dockerfile.run'
if 'gempak' in str(requirements).lower():
Expand Down
1 change: 1 addition & 0 deletions internal_tests/use_cases/all_use_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Category: s2s_mid_lat
2::UserScript_obsERA_obsOnly_WeatherRegime:: model_applications/s2s_mid_lat/UserScript_obsERA_obsOnly_WeatherRegime.conf:: weatherregime_env,cartopy,metplus
3:: UserScript_fcstGFS_obsERA_WeatherRegime:: model_applications/s2s_mid_lat/UserScript_fcstGFS_obsERA_WeatherRegime.conf:: weatherregime_env,cartopy,metplus


Category: s2s_mjo
0:: UserScript_obsERA_obsOnly_PhaseDiagram:: model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram.conf:: spacetime_env
1:: UserScript_fcstGFS_obsERA_OMI:: model_applications/s2s_mjo/UserScript_fcstGFS_obsERA_OMI.conf:: spacetime_env, metdataio
Expand Down
9 changes: 5 additions & 4 deletions scripts/docker/docker_env/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Dockerfile to create conda environments used for use case tests

ARG BASE_ENV=metplus_base
ARG BASE_ENV=metplus_base.v5
FROM dtcenter/metplus-envs:${BASE_ENV}

ARG ENV_NAME
WORKDIR /scripts
COPY scripts/${ENV_NAME}_env.sh .

ARG BASE_ENV=metplus_base
RUN ./${ENV_NAME}_env.sh ${BASE_ENV}
ARG BASE_ENV=metplus_base.v5
RUN conda update -y -n base -c defaults conda \
&& ./${ENV_NAME}_env.sh ${BASE_ENV}

RUN conda list --name ${ENV_NAME} > /usr/local/envs/${ENV_NAME}/environments.yml
RUN conda list --name ${ENV_NAME}.v5 > /usr/local/envs/${ENV_NAME}.v5/environments.yml
2 changes: 1 addition & 1 deletion scripts/docker/docker_env/Dockerfile.metplus_base
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ COPY scripts/metplus_base_env.sh .
RUN conda update -y -n base -c defaults conda \
&& ./metplus_base_env.sh

RUN conda list --name metplus_base > /usr/local/envs/metplus_base/environments.yml
RUN conda list --name metplus_base.v5 > /usr/local/envs/metplus_base.v5/environments.yml
2 changes: 1 addition & 1 deletion scripts/docker/docker_env/Dockerfile.py_embed_base
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ COPY scripts/py_embed_base_env.sh .
RUN conda update -y -n base -c defaults conda \
&& ./py_embed_base_env.sh

RUN conda list --name py_embed_base > /usr/local/envs/py_embed_base/environments.yml
RUN conda list --name py_embed_base.v5 > /usr/local/envs/py_embed_base.v5/environments.yml
Loading