From 8eef1aa062a80e63c7416fc7442dd062bc057c4d Mon Sep 17 00:00:00 2001 From: James Foucar Date: Thu, 17 Oct 2024 17:05:44 -0600 Subject: [PATCH 1/2] Update EAMxx docs and improve help formatters --- components/eamxx/docs/developer/ci_nightly.md | 17 +++++- .../eamxx/docs/developer/cime_testing.md | 60 +++++++++++++++++-- .../docs/developer/standalone_testing.md | 35 ++++++++++- components/eamxx/scripts/atmchange | 4 +- components/eamxx/scripts/atmquery | 4 +- components/eamxx/scripts/check-hashes-ers | 4 +- components/eamxx/scripts/check-input | 4 +- components/eamxx/scripts/check-tendencies | 4 +- components/eamxx/scripts/cime-nml-tests | 4 +- components/eamxx/scripts/compare-nc-files | 4 +- .../eamxx/scripts/eamxx-params-docs-autogen | 4 +- components/eamxx/scripts/gather-all-data | 4 +- components/eamxx/scripts/gen-boiler | 4 +- components/eamxx/scripts/git-merge-ref | 4 +- components/eamxx/scripts/machines_specs.py | 2 +- components/eamxx/scripts/nc-file-init | 4 +- components/eamxx/scripts/perf-analysis | 4 +- components/eamxx/scripts/plot | 4 +- components/eamxx/scripts/populate-nc-file | 6 +- components/eamxx/scripts/query-cime | 4 +- components/eamxx/scripts/query-scream | 4 +- components/eamxx/scripts/scream-env-cmd | 4 +- components/eamxx/scripts/scripts-ctest-driver | 4 +- components/eamxx/scripts/scripts-tests | 4 +- components/eamxx/scripts/test-all-scream | 8 ++- components/eamxx/scripts/utils.py | 14 ++++- 26 files changed, 165 insertions(+), 53 deletions(-) diff --git a/components/eamxx/docs/developer/ci_nightly.md b/components/eamxx/docs/developer/ci_nightly.md index 4089f523daf..b222139dd55 100644 --- a/components/eamxx/docs/developer/ci_nightly.md +++ b/components/eamxx/docs/developer/ci_nightly.md @@ -1,4 +1,17 @@ # Continuous Integration and Nightly Testing -* Autotester quick overview -* Nightly overview, CDash +## Autotester ## + +EAMxx using github actions and a Sandia product called Autotester 2 +to run CI testing on a CPU and GPU machine for every github pull +request. By default, we run the e3sm_scream_v1_at suite and the +standalone eamxx tests (test-all-scream). + +## Nightly overview, CDash ## + +Our nightly testing is much more extensive than the CI testing. You +can see our dashboard here under the section "E3SM_SCREAM": +https://my.cdash.org/index.php?project=E3SM + +We run a variety of CIME test suites and standalone testing on a number +of platforms. We even do some performance testing on frontier. diff --git a/components/eamxx/docs/developer/cime_testing.md b/components/eamxx/docs/developer/cime_testing.md index 7c2d91a3657..71233a245b4 100644 --- a/components/eamxx/docs/developer/cime_testing.md +++ b/components/eamxx/docs/developer/cime_testing.md @@ -1,7 +1,59 @@ # Full Model Testing -Quickly review CIME test infrastructure and how EAMxx uses it +Full model system testing of eamxx is done through CIME test cases +(much like the rest of E3SM). -* test types, specifiers (`_LnX`,`_D`,`_PMxN`,..), grids, compsets, test-mods -* available grids/compsets for EAMxx, and where to find them -* how to add atmchange in `shell_commands` test mods +We offer a number of test suites, including: +* e3sm_scream_v0: Test the full set of V0 (pre-C++) tests +* e3sm_scream_v1: Test the full set of V1 (C++) tests +* e3sm_scream_v1_at: A smaller and quicker set of tests for autotesting +* e3sm_scream_hires: A small number of bigger, longer-running tests to measure performance + +Example for running a suite: +``` +% cd $repo/cime/scripts +% ./create_test e3sm_scream_v1_at --wait +``` + +Example for running a single test case: +``` +% cd $repo/cime/scripts +% ./create_test SMS.ne4_ne4.F2010-SCREAMv1 --wait +``` + +There are many behavioral tweaks you can make to a test case, like +changing the run length, test type, etc. Most of this is not specific +to eamxx and works for any CIME case. This generic stuff +is well-documentated here: +http://esmci.github.io/cime/versions/master/html/users_guide/testing.html + +When it comes to things specific to eamxx, you have grids, compsets, and +testmods. + +Common EAMxx grids are: +* ne4_ne4 (low resolution) +* ne4pg2_ne4pg2 (low resolution with phys grid) +* ne30_ne30 (med resolution) +* ne30pg2_ne30pg2 (med resolution with phys grid) +* ne1024pg2_ne1024pg2 (ultra high with phys grid) + +More grid info can be found here: +https://acme-climate.atlassian.net/wiki/spaces/DOC/pages/933986549/ATM+Grid+Resolution+Summary + +Common EAMxx compsets are: +* F2010-SCREAM-LR: V0 low res compset with eamxx V0 atmosphere +* F2010-SCREAMv1: V1 standard compset with eamxx V1 atmosphere +* FIOP-SCREAMv1-DP: V1 with dpxx (doubly-periodic lateral boundary condition in C++) +* F2010-SCREAMv1-noAero: V1 without aerosol forcing + +Full info on supported compsets can be found by looking at this file: +`$scream_repo/components/eamxx/cime_config/config_compsets.xml` + +Common EAMxx testmods are: +* small_kernels: Enable smaller-granularity kernels, can improve performance on some systems +* scream-output-preset-[1-6]: Our 6 output presets. These turn some combination of our three output streams (phys_dyn, phys, and diags), + various remaps, etc. +* bfbhash: Turns on bit-for-bit hash output: https://acme-climate.atlassian.net/wiki/spaces/NGDNA/pages/3831923056/EAMxx+BFB+hashing + +More info on running EAMxx can be found here: +https://acme-climate.atlassian.net/wiki/spaces/DOC/pages/3386015745/How+To+Run+EAMxx+SCREAMv1 diff --git a/components/eamxx/docs/developer/standalone_testing.md b/components/eamxx/docs/developer/standalone_testing.md index 63ea01fc612..215ad7440ca 100644 --- a/components/eamxx/docs/developer/standalone_testing.md +++ b/components/eamxx/docs/developer/standalone_testing.md @@ -21,7 +21,40 @@ configurations. We use several types of tests the [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command. We also support a `test-all-scream` configuration that runs all of the -standalone tests for an EAMxx configuration. +standalone tests for an EAMxx configuration. Note, your current machine +must be known to EAMxx before `test-all-scream` will work. A machine can +be made known to EAMxx by editing the eamxx/scripts/machines_specs.py files. +There are some instructions on what to do at the top of this file. + +`test-all-scream` has a good help dump +``` +% cd $scream_repo/components/eamxx +% ./scripts/test-all-scream -h +``` + +If you are unsure of the cmake configuration for you development cycle, one +trick you can use is to run `test-all-scream` for the `dbg` test and just +copy the cmake command it prints (then ctrl-C the process). +``` +% cd $scream_repo/components/eamxx +% ./scripts/test-all-scream -t dbg -m $machine +* wait for a few seconds* +* Ctrl-C * +* Copy the contents of DCMAKE_COMMAND that was passed to ctest * +* Add "cmake" to beginning of contents and path to eamxx at the end. * +``` + +Considerations for using `test-all-scream`: +* Your machine must be known to our scripts, see above. +* test-all-scream expects to be run from a compute node if you + are on a batch machine. +* You'll need to think about your baseline situation, as many of our + tests rely on pre-existing baselines. The -b option controls the baseline + location and can have the following values: + * AUTO: A common public baseline area shared by all developers + * LOCAL: A private baseline area for the current developer in the current repo + * $path: A specific arbitrary path + * None: If there is no -b at all, no baseline testing will be done ## Running EAMxx's Tests with CTest diff --git a/components/eamxx/scripts/atmchange b/components/eamxx/scripts/atmchange index eb8de06a693..6303cad6ca6 100755 --- a/components/eamxx/scripts/atmchange +++ b/components/eamxx/scripts/atmchange @@ -15,7 +15,7 @@ sys.path.append(os.path.dirname(os.path.realpath(__file__))) from eamxx_buildnml_impl import check_value, is_array_type from eamxx_buildnml import create_raw_xml_file from atm_manip import atm_config_chg_impl, buffer_changes, reset_buffer, get_xml_nodes, parse_change -from utils import run_cmd_no_fail, expect +from utils import run_cmd_no_fail, expect, GoodFormatter # Add path to cime _CIMEROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..","..","..","cime") @@ -110,7 +110,7 @@ OR > {0} foo=hi bar+=there """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument( diff --git a/components/eamxx/scripts/atmquery b/components/eamxx/scripts/atmquery index 1dbfbe5f579..2ca2692ccc8 100755 --- a/components/eamxx/scripts/atmquery +++ b/components/eamxx/scripts/atmquery @@ -14,7 +14,7 @@ sys.path.append(os.path.dirname(os.path.realpath(__file__))) from eamxx_buildnml_impl import check_value from atm_manip import atm_query_impl -from utils import expect +from utils import expect, GoodFormatter ############################################################################### def atm_query(variables,listall=False,full=False,value=False, \ @@ -55,7 +55,7 @@ OR """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument( diff --git a/components/eamxx/scripts/check-hashes-ers b/components/eamxx/scripts/check-hashes-ers index 6d9da4b2f98..4bcfab36c14 100755 --- a/components/eamxx/scripts/check-hashes-ers +++ b/components/eamxx/scripts/check-hashes-ers @@ -10,7 +10,7 @@ hash output after a test has run. import sys, re, glob, pathlib, argparse -from utils import run_cmd_no_fail, expect +from utils import run_cmd_no_fail, expect, GoodFormatter ############################################################################### def parse_command_line(args, description): @@ -25,7 +25,7 @@ OR > {0} /my/case/dir """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument( diff --git a/components/eamxx/scripts/check-input b/components/eamxx/scripts/check-input index 4bac4af8b9b..a4d50331116 100755 --- a/components/eamxx/scripts/check-input +++ b/components/eamxx/scripts/check-input @@ -4,7 +4,7 @@ Download SCREAM input files using CIME """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -24,7 +24,7 @@ OR > {0} /my/input/root my/file """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("input_root", help="The root input area (called DIN_LOC_ROOT in CIME)") diff --git a/components/eamxx/scripts/check-tendencies b/components/eamxx/scripts/check-tendencies index c044995f5d2..4a3b42aa27d 100755 --- a/components/eamxx/scripts/check-tendencies +++ b/components/eamxx/scripts/check-tendencies @@ -10,7 +10,7 @@ (other dims omitted for brevity). """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -24,7 +24,7 @@ def parse_command_line(args, description): usage=" {0} -f -v -t " .format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.RawDescriptionHelpFormatter + formatter_class=GoodFormatter ) # The name of the nc files where to grab data from diff --git a/components/eamxx/scripts/cime-nml-tests b/components/eamxx/scripts/cime-nml-tests index d5ed8e14f2e..e03151579ee 100755 --- a/components/eamxx/scripts/cime-nml-tests +++ b/components/eamxx/scripts/cime-nml-tests @@ -6,7 +6,7 @@ namelist-related infrastructure. """ from utils import check_minimum_python_version, expect, ensure_pylint, get_timestamp, \ - run_cmd_assert_result, run_cmd_no_fail, run_cmd + run_cmd_assert_result, run_cmd_no_fail, run_cmd, GoodFormatter check_minimum_python_version(3, 6) @@ -410,7 +410,7 @@ OR parser = argparse.ArgumentParser( usage=help_str, description=desc, - formatter_class=argparse.ArgumentDefaultsHelpFormatter) + formatter_class=GoodFormatter) parser.add_argument("-m", "--machine", help="Provide machine name. This is required for full (not dry) runs") diff --git a/components/eamxx/scripts/compare-nc-files b/components/eamxx/scripts/compare-nc-files index 9ca9675545e..f8857b530ce 100755 --- a/components/eamxx/scripts/compare-nc-files +++ b/components/eamxx/scripts/compare-nc-files @@ -5,7 +5,7 @@ Populates a netcdf file adding requested variables, either importing them from another file, or by computing them as function of other existing ones. """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -36,7 +36,7 @@ OR """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) # The name of the nc files where to grab data from diff --git a/components/eamxx/scripts/eamxx-params-docs-autogen b/components/eamxx/scripts/eamxx-params-docs-autogen index 9bea5242d5a..90e19ed59d6 100755 --- a/components/eamxx/scripts/eamxx-params-docs-autogen +++ b/components/eamxx/scripts/eamxx-params-docs-autogen @@ -10,7 +10,7 @@ a doc string and its type, as well as, if present, constraints and valid values. import argparse, sys, os, pathlib -from utils import _ensure_pylib_impl +from utils import _ensure_pylib_impl, GoodFormatter _ensure_pylib_impl("mdutils") @@ -29,7 +29,7 @@ def parse_command_line(args, description): usage="""{0} """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) return parser.parse_args(args[1:]) diff --git a/components/eamxx/scripts/gather-all-data b/components/eamxx/scripts/gather-all-data index be2153498db..f56bd416b20 100755 --- a/components/eamxx/scripts/gather-all-data +++ b/components/eamxx/scripts/gather-all-data @@ -20,7 +20,7 @@ A number of options support automatic magic strings. See the help for individual options to see which magic strings are supported. """ -from utils import expect, check_minimum_python_version +from utils import expect, check_minimum_python_version, GoodFormatter from git_utils import get_current_commit check_minimum_python_version(3, 5) @@ -52,7 +52,7 @@ OR > {0} '$scream/scripts/perf-analysis ncol:8000 km1:128 km2:256 minthresh:0.001 repeat:10 --kokkos=$kokkos --test=lin-interp/li_ref --test=lin-interp/li_kokkos --test=lin-interp/li_vect -s ncol:2:128000' -m blake -o """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("run", help="What to run on the machine, cwd for the command will be root-dir. " diff --git a/components/eamxx/scripts/gen-boiler b/components/eamxx/scripts/gen-boiler index e1696d820a4..47fb46d857e 100755 --- a/components/eamxx/scripts/gen-boiler +++ b/components/eamxx/scripts/gen-boiler @@ -11,7 +11,7 @@ To test this tool, run: % python3 -m doctest gen_boiler.py """ -from utils import expect, check_minimum_python_version +from utils import expect, check_minimum_python_version, GoodFormatter from git_utils import get_git_toplevel_dir check_minimum_python_version(3, 5) @@ -42,7 +42,7 @@ OR > {0} foo_bar --piece=f90_f2c_bind --piece=f90_c2f_bind -o --physics=p3 """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.RawTextHelpFormatter + formatter_class=GoodFormatter ) default_repo = get_git_toplevel_dir() diff --git a/components/eamxx/scripts/git-merge-ref b/components/eamxx/scripts/git-merge-ref index 24d767c03a5..363f0f6045f 100755 --- a/components/eamxx/scripts/git-merge-ref +++ b/components/eamxx/scripts/git-merge-ref @@ -4,7 +4,7 @@ A command-line tool foro calling merge_git_ref """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -24,7 +24,7 @@ OR > {0} origin/master """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("git_ref", help="The git ref to merge") diff --git a/components/eamxx/scripts/machines_specs.py b/components/eamxx/scripts/machines_specs.py index af61c2bff5f..9cf079dafa6 100644 --- a/components/eamxx/scripts/machines_specs.py +++ b/components/eamxx/scripts/machines_specs.py @@ -8,7 +8,7 @@ # MACHINE -> (env_setup, # list of shell commands to set up scream-approved env # compilers, # list of compilers [CXX, F90, C] -# batch submit prefix, # string shell commmand prefix +# batch submit prefix, # string shell commmand prefix, leave blank for non-batch machines # pre-existing baselines root dir # string path) MACHINE_METADATA = { # NOTE: blake must use a different minor version of python than weaver diff --git a/components/eamxx/scripts/nc-file-init b/components/eamxx/scripts/nc-file-init index 0af21e5f1a1..7657b34b4b9 100755 --- a/components/eamxx/scripts/nc-file-init +++ b/components/eamxx/scripts/nc-file-init @@ -5,7 +5,7 @@ Create a netcdf file for a cubed sphere geometry, with given vertical and horizontal resolution, adding requested variable (to be set to 0). """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -32,7 +32,7 @@ OR """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) # The file name diff --git a/components/eamxx/scripts/perf-analysis b/components/eamxx/scripts/perf-analysis index 4e71b41f97c..f9a66c984cb 100755 --- a/components/eamxx/scripts/perf-analysis +++ b/components/eamxx/scripts/perf-analysis @@ -5,7 +5,7 @@ Run different versions of an app and compare performance. It is expected that this will be run from micro-apps directory. """ -from utils import expect, check_minimum_python_version +from utils import expect, check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, os, socket @@ -38,7 +38,7 @@ OR > {0} ni:64 --test=ref:"src/physics/shoc/tests/shoc_run_and_cmp_cxx -r 10 -s 30 -i NI foo" -s ni:2:8192 --cd """.format(os.path.basename(args[0])), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("argmap", nargs="+", help="Argument map, NAME:STARTING_VAL. First arg is assumed to be the arg/s used in the core metric") diff --git a/components/eamxx/scripts/plot b/components/eamxx/scripts/plot index 0df75b312db..59f962f59b1 100755 --- a/components/eamxx/scripts/plot +++ b/components/eamxx/scripts/plot @@ -4,7 +4,7 @@ Plot results from perf_analysis """ -from utils import expect, check_minimum_python_version +from utils import expect, check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 5) import matplotlib.pyplot as plt @@ -34,7 +34,7 @@ OR > {0} /weaver /weaver -v commit:version """.format(os.path.basename(args[0])), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("datafiles", nargs="+", help="Data file to plot") diff --git a/components/eamxx/scripts/populate-nc-file b/components/eamxx/scripts/populate-nc-file index 0cc8de3d1a0..6fd9323893f 100755 --- a/components/eamxx/scripts/populate-nc-file +++ b/components/eamxx/scripts/populate-nc-file @@ -5,7 +5,7 @@ Populates a netcdf file adding requested variables, either importing them from another file, or by computing them as function of other existing ones. """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -44,14 +44,14 @@ OR > ./{0} -f my_file.nc -ifile f2.nc -ivars rho T -cvars p=rho*T^1.5 -rvars rho T - \033[1;32m# Appends to existing netcdf file, regridding T from file f2.nc, using map file map.nc + \033[1;32m# Appends to existing netcdf file, regridding T from file f2.nc, using map file map.nc and deleting rho,T from the output file. Uses nco's ncremap. > ./{0} -f my_file.nc -ifile f2.nc -ivars T -mfile map.nc """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) # The name of the nc file to populate, plus auxiliary files diff --git a/components/eamxx/scripts/query-cime b/components/eamxx/scripts/query-cime index 68472ac2555..46d42668823 100755 --- a/components/eamxx/scripts/query-cime +++ b/components/eamxx/scripts/query-cime @@ -4,7 +4,7 @@ Query the CIME config_machines.xml file """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -24,7 +24,7 @@ OR > {0} mappy DIN_LOC_ROOT """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("machine", help="The name of the machine") diff --git a/components/eamxx/scripts/query-scream b/components/eamxx/scripts/query-scream index 240552b3b75..b1cec87c90a 100755 --- a/components/eamxx/scripts/query-scream +++ b/components/eamxx/scripts/query-scream @@ -4,7 +4,7 @@ Query the SCREAM machines_specs.py file """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -24,7 +24,7 @@ OR > {0} mappy cxx_compiler """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("machine", help="The name of the machine") diff --git a/components/eamxx/scripts/scream-env-cmd b/components/eamxx/scripts/scream-env-cmd index a808c7fd5f7..34b5293807f 100755 --- a/components/eamxx/scripts/scream-env-cmd +++ b/components/eamxx/scripts/scream-env-cmd @@ -6,7 +6,7 @@ This can be used with a bash function or the source_to_load_scream_env.sh script to conveniently load the SCREAM-approved env into your current shell. """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) from machines_specs import get_mach_env_setup_command @@ -41,7 +41,7 @@ OR """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("mach", help="The machine name for which you want the scream env") diff --git a/components/eamxx/scripts/scripts-ctest-driver b/components/eamxx/scripts/scripts-ctest-driver index 94250eea0de..ba5632402c9 100755 --- a/components/eamxx/scripts/scripts-ctest-driver +++ b/components/eamxx/scripts/scripts-ctest-driver @@ -5,7 +5,7 @@ Drive ctest testing of scream's scripts. Because this includes testing of jenkins scripts, it should always be run from a login node. """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -26,7 +26,7 @@ OR > ./scripts/{0} -m mappy """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("-s", "--submit", action="store_true", help="Submit results to dashboad") diff --git a/components/eamxx/scripts/scripts-tests b/components/eamxx/scripts/scripts-tests index 1fd2e48c1b4..92e62762036 100755 --- a/components/eamxx/scripts/scripts-tests +++ b/components/eamxx/scripts/scripts-tests @@ -10,7 +10,7 @@ If you are on a batch machine, it is expected that you are on a compute node. TODO: Add doctests to libs """ -from utils import check_minimum_python_version, expect, ensure_pylint, run_cmd_no_fail, run_cmd_assert_result +from utils import check_minimum_python_version, expect, ensure_pylint, run_cmd_no_fail, run_cmd_assert_result, GoodFormatter check_minimum_python_version(3, 6) @@ -544,7 +544,7 @@ OR parser = argparse.ArgumentParser( usage=help_str, description=desc, - formatter_class=argparse.ArgumentDefaultsHelpFormatter) + formatter_class=GoodFormatter) parser.add_argument("-m", "--machine", help="Provide machine name. This is required for full (not dry) runs") diff --git a/components/eamxx/scripts/test-all-scream b/components/eamxx/scripts/test-all-scream index 3dc820581f7..da388278663 100755 --- a/components/eamxx/scripts/test-all-scream +++ b/components/eamxx/scripts/test-all-scream @@ -15,7 +15,9 @@ Baselines: By default, test-all-scream will not run baseline tests. If you set the location specified by the machine spec. You can regenerate baselines any time by using the -g flag, but be aware this will impact everyone if you regenerate the public baselines. You can change the target baseline area -using -b $path. If -g is provided, no tests will be run; -g means generate only. +using -b $path. You can also use the magic word "LOCAL" to have test-all-scream +pick a local directory for you if you want to manage your own baselines within +the current repo. If -g is provided, no tests will be run; -g means generate only. The general workflow for baseline-changing PRs is: 1) Issue PR @@ -32,7 +34,7 @@ do for create_test tests, the only difference is that test-all-scream does basel comparison tests by default. """ -from utils import check_minimum_python_version +from utils import check_minimum_python_version, GoodFormatter check_minimum_python_version(3, 4) import argparse, sys, pathlib @@ -70,7 +72,7 @@ OR > ./scripts/{0} -m mappy -t dbg """.format(pathlib.Path(args[0]).name), description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter + formatter_class=GoodFormatter ) parser.add_argument("-cxx","--cxx-compiler", help="C++ compiler", default=None) diff --git a/components/eamxx/scripts/utils.py b/components/eamxx/scripts/utils.py index 9aafd09ae8a..4844297bdcc 100644 --- a/components/eamxx/scripts/utils.py +++ b/components/eamxx/scripts/utils.py @@ -2,7 +2,7 @@ Utilities """ -import os, sys, re, signal, subprocess, site, time, shutil +import os, sys, re, signal, subprocess, site, time, shutil, argparse from importlib import import_module import stat as statlib from pathlib import Path @@ -495,3 +495,15 @@ def safe_copy(src_path, tgt_path, preserve_meta=True): os.chmod( tgt_path, st.st_mode | statlib.S_IXUSR | statlib.S_IXGRP | statlib.S_IXOTH ) + +############################################################################### +class GoodFormatter( + argparse.ArgumentDefaultsHelpFormatter, + argparse.RawDescriptionHelpFormatter +): +############################################################################### + """ + We want argument default info to be added but we also want to + preserve formatting in the description string. + """ + pass From 29fdc0d253ba9c5081fead23cda62e93d5d832ea Mon Sep 17 00:00:00 2001 From: James Foucar Date: Fri, 18 Oct 2024 09:38:17 -0600 Subject: [PATCH 2/2] Remind devs to load scream env --- components/eamxx/docs/developer/standalone_testing.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/eamxx/docs/developer/standalone_testing.md b/components/eamxx/docs/developer/standalone_testing.md index 215ad7440ca..e2bb5d62556 100644 --- a/components/eamxx/docs/developer/standalone_testing.md +++ b/components/eamxx/docs/developer/standalone_testing.md @@ -46,6 +46,9 @@ copy the cmake command it prints (then ctrl-C the process). Considerations for using `test-all-scream`: * Your machine must be known to our scripts, see above. +* If you try to run commands by-hand (outside of test-all-scream; cmake, make, ctest, etc), you'll need to remember to + load the scream-env into your shell, which can be done like this: + `cd eamxx/scripts; eval $(./scripts/scream-env-cmd $machine)` * test-all-scream expects to be run from a compute node if you are on a batch machine. * You'll need to think about your baseline situation, as many of our