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

compass python package (compass v1.0) #28

Merged
merged 306 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from 231 commits
Commits
Show all changes
306 commits
Select commit Hold shift + click to select a range
31ca8ad
Fix many PEP8 issues
xylar Dec 26, 2020
68af7b1
Add license file from MPAS-Model
xylar Dec 26, 2020
dc5a9c9
Add setup module and update recipe
xylar Dec 26, 2020
dad90fa
Add a module for plotting ocean initial conditions
xylar Dec 27, 2020
75983ba
Add the tanh_dz option for vertical grids
xylar Dec 27, 2020
9fbb549
Clean up a "not ... in" that should be a "not in"
xylar Dec 27, 2020
d7a5e0d
Add global_ocean initial_state testcase
xylar Dec 27, 2020
23750eb
Split init into mesh and initial_state
xylar Dec 27, 2020
efb5280
Add global ocean performance test
xylar Dec 28, 2020
5d06842
Turn off global status in SSH adjustment
xylar Dec 28, 2020
2d06274
Switch to logging with a context manager
xylar Dec 30, 2020
c97df0f
Add base workdir to testcases and steps
xylar Dec 31, 2020
61fe19d
Add testcase subdir to steps
xylar Dec 31, 2020
fe74aed
Add split_explicit and RK4 to global ocean forward
xylar Dec 31, 2020
ac9646a
Update ocean nightly regression suite
xylar Jan 1, 2021
9c0b0f4
Fix formatting of baroclinic channel restart namelist
xylar Jan 1, 2021
96f7f06
Add global ocean restart tests
xylar Jan 2, 2021
a8d326b
Add global ocean decomposition and thread tests
xylar Jan 2, 2021
0d11052
Modify validation to handle repeats of a dimension
xylar Jan 2, 2021
44ce836
Add global ocean analysis test
xylar Jan 2, 2021
bf38666
Add add step for global ocean BGC initial state
xylar Jan 2, 2021
217b202
Add BGC ecosystem testcase to global ocean
xylar Jan 2, 2021
53e274f
Add global ocean daily output testcase
xylar Jan 2, 2021
8253d92
Fix text in plot of vertical grid
xylar Jan 4, 2021
0dae4c5
Major reorg of global ocean test case
xylar Jan 4, 2021
e259794
Update nightly and add qu240wisc test suite
xylar Jan 4, 2021
b8a3a70
Change the way steps run on their own
xylar Jan 6, 2021
1eca43a
Update example testcases following reorg
xylar Jan 6, 2021
6d51c55
Update baroclinic channel testcases following reorg
xylar Jan 6, 2021
3252801
Update 2D ice-shelf testcase following reorg
xylar Jan 6, 2021
f39994a
Update ziso testcases following reorg
xylar Jan 6, 2021
45dd43a
Update global ocean testcases and steps following reorg
xylar Jan 6, 2021
21aa591
Add EC30to60 and ECwISC30to60 testcases
xylar Jan 6, 2021
2343d7a
Updates mesh and IC description adding to configs
xylar Jan 6, 2021
44f6d34
Add metadata to output files
xylar Jan 8, 2021
2cb4b75
Fix name of QUwISC240 test suite
xylar Jan 8, 2021
e1a7c94
Remove hard-coded cores and treads in performance test
xylar Jan 8, 2021
ea734d7
Modify spacing in global ocean configs
xylar Jan 8, 2021
5220844
Add restart files as inputs/outputs for restart test
xylar Jan 9, 2021
1f5eb3a
Add spinup testcases
xylar Jan 9, 2021
bff6a18
Add function for getting E3SM mesh names
xylar Jan 10, 2021
c87615d
Make max_depth and levels be strings in metadata
xylar Jan 10, 2021
2d37460
Fix logging bug in testcases and steps
xylar Jan 10, 2021
16005b6
Add testcase only once to suite
xylar Jan 10, 2021
a37e7fa
Add final restart file as spin-up output
xylar Jan 10, 2021
bac8113
Add first draft of files for E3SM testcase
xylar Jan 10, 2021
cfc32e1
Update version of mpas_tools in the recipe
xylar Jan 11, 2021
7b30bde
Fix PEP8 issues with global_ocean test cases
xylar Jan 11, 2021
0d61a3b
Update anvil and add chrysalis
xylar Jan 11, 2021
095e157
Fix slurm check for processor count
xylar Jan 11, 2021
0a820ec
Fix error message in compass suite command
xylar Jan 11, 2021
9b1ba50
Add test suites for EC and ECwISC meshes
xylar Jan 13, 2021
3b1ea08
Fix logging of test suites
xylar Jan 13, 2021
79e179a
Fix the stride between PIO processes
xylar Jan 13, 2021
f079617
Fix 60layerPHC depths (m instead of cm)
xylar Jan 13, 2021
bf31da6
Make separate namelists for PHC and EN4_1900 tracers
xylar Jan 13, 2021
3646435
Switch to adding global attributes with ncra
xylar Jan 13, 2021
b6a029f
Remove unused import
xylar Jan 16, 2021
195a14e
Get mesh cores, memory usage from config file
xylar Jan 16, 2021
6b5263d
Fix name of restart files in restart test case
xylar Jan 16, 2021
3327593
Fix abs path for global ocean test case outputs
xylar Jan 16, 2021
27cfc4e
Replace COMPASS --> compass within the pacakge
xylar Jan 16, 2021
ea8a2db
Remove unused vert_levels option from ZISO
xylar Jan 19, 2021
87c04f8
Add comment about conda envs in machine configs
xylar Jan 19, 2021
3051b40
Print a message if all tests in suite pass.
xylar Jan 20, 2021
d4e5eea
Fix arguments to baroclinic_channel RPE analysis step
xylar Jan 20, 2021
44a7a34
Add an example ocean config file
xylar Jan 20, 2021
8bfbc82
Fix a typo in the comments for the machine configs
xylar Jan 20, 2021
2792c2c
Add timing to suite output
xylar Jan 20, 2021
271c9a3
Compute the target and min cores for suites
xylar Jan 20, 2021
823e95e
Add commandline flag --mpas_model
xylar Jan 20, 2021
62917c6
Print PASS/FAIL next to runtimes
xylar Jan 20, 2021
73c8919
Add landIceMask to sea-ice initial condition
xylar Jan 22, 2021
5f0e989
Add prog argument to argparse
xylar Jan 23, 2021
7505760
Improve function for listing test suites
xylar Jan 23, 2021
70d2a54
Fix or add some docstrings
xylar Jan 23, 2021
1f73c5a
Fix PEP8
xylar Jan 23, 2021
5019412
Fix metavar for compass suite -t
xylar Jan 23, 2021
c0bb06e
Fix typo in example test cases
xylar Jan 26, 2021
136ea41
Add listing machines and suites to conda recipe
xylar Jan 27, 2021
a96d68e
Update setup.py to include package_data files
xylar Jan 27, 2021
c7693a8
Update Azure Pipelines
xylar Jan 28, 2021
495851b
Add resource limits to baroclinic channel RPE analysis step
xylar Jan 28, 2021
4dfca2b
Rewrite run_model to take the step dict and do more
xylar Jan 28, 2021
2b5c6d5
Rework namelsits and streams generation
xylar Jan 28, 2021
ddc9ad9
Change the way step inputs and outputs are handled
xylar Jan 29, 2021
b73ade9
Update baroclinic_channel with run_model changes
xylar Jan 28, 2021
e1f291c
Rework collecting test cases and steps
xylar Jan 30, 2021
bc59f35
Update baroclinic_channel with new collection API
xylar Jan 30, 2021
e0dc3d4
Update adjust_ssh with run_model changes
xylar Jan 30, 2021
9094fdd
Add support for steps without setup() functions
xylar Jan 30, 2021
c95d36f
Update global_ocean with new framework API
xylar Jan 30, 2021
c8f68b1
Update ice_shelf_2d with new framework API
xylar Jan 31, 2021
93290a7
Update ziso with new framework API
xylar Jan 31, 2021
cae3c45
Add some sanity checks for cores and min_cores in suite
xylar Jan 31, 2021
e6e168f
A bit of docstring clean-up (testcase --> test case)
xylar Jan 31, 2021
c6e68af
Update examples with new framework API
xylar Jan 31, 2021
3073616
Add function for making a graph file
xylar Feb 3, 2021
6cfa7e9
Only partition for cores > 1
xylar Feb 3, 2021
35f1caf
Add landice core and dome configuration
xylar Feb 3, 2021
8ee7a88
Add landice enthalpy_benchmark configuration
xylar Feb 5, 2021
f944619
Fix global ocean SSH adjustment
xylar Feb 6, 2021
0f7c6d8
Add diagnostics file to the files_for_e3sm test
xylar Feb 6, 2021
541dd92
Improve test suite output message
xylar Feb 7, 2021
cdeabc8
Rarrange global ocean subdirs; reduce number of tests
xylar Feb 7, 2021
4776e39
Fix bug in particle remapping
xylar Feb 28, 2021
f359448
Fix vertical interface data files
xylar Mar 1, 2021
d75077f
Fix docstring on global_ocean.subdir
xylar Mar 3, 2021
04db5a7
Add so12to60 mesh
xylar Mar 3, 2021
de69fbd
Fix comment Bedmap2 --> BedMachine
xylar Mar 9, 2021
7030fd3
Update to latest MPAS-Model/landice/develop
xylar Mar 9, 2021
1fc3100
Add eismint2 configuration
xylar Mar 9, 2021
02e9c52
Add eismint2 decomposition test
xylar Mar 9, 2021
023c410
add eismint2 restart test
xylar Mar 9, 2021
5877902
Add eismint2 enthalpy tests
xylar Mar 9, 2021
afaf322
Add eismint2 tests to sia suite
xylar Mar 9, 2021
f96852a
Update submodule at MPAS-Model/ocean/develop
xylar Mar 10, 2021
7029c80
Fix namelist options --> config options
xylar Mar 10, 2021
8d0efca
Add greenland configuration
xylar Mar 10, 2021
e787cdd
Add hydro_radial configuration
xylar Mar 10, 2021
49c0f15
Fix modifySSHMask --> modifyLandIcePressureMask
xylar Mar 11, 2021
782ebcc
Add landice to compass list --suites
xylar Mar 12, 2021
1709a19
Update deployment script for compass 1.0 testing
xylar Mar 13, 2021
e91aba8
Set up example_configs directory
xylar Mar 13, 2021
bb6d679
Tighten up test suite screen output
mark-petersen Mar 13, 2021
584114e
Improve comparison output, written to file
mark-petersen Mar 14, 2021
00fe00c
Fix string formatting
xylar Mar 14, 2021
6ef58fd
A few small bits of clean-up
xylar Mar 20, 2021
14037d8
Alphabetize requirements
xylar Mar 22, 2021
4c57aa9
Update jigsaw and jigsawpy
xylar Mar 22, 2021
d4a1a32
Disable pip check for now
xylar Mar 22, 2021
2b06eab
Turn on pip check
xylar Mar 24, 2021
fff364c
Update ocean/develop submodule
xylar Mar 25, 2021
0728d9c
Update 3 namelist options that have been renamed
xylar Mar 25, 2021
d277431
Limit cores to cores_per_node for single_node machines
xylar Mar 29, 2021
76ddee8
Split qu240 and quwisc240 spinups into separate suites
xylar Mar 29, 2021
283593a
Add a class MpasCore
xylar Apr 8, 2021
c473227
Add a class TestGroup
xylar Apr 8, 2021
a9c3471
Add a class TestCase
xylar Apr 8, 2021
2689021
Add a class Step and a step package
xylar Apr 8, 2021
1d96c75
Import the new classes directly in compass
xylar Apr 8, 2021
2065ed5
Move add_input_file and add_output_file to Step
xylar Apr 8, 2021
a6d674a
Remove testcases module
xylar Apr 8, 2021
dc27f0c
Move add_model_as_input to Step
xylar Apr 8, 2021
213e875
Add get_mpas_cores function to collect all cores
xylar Apr 8, 2021
2de4596
Update compass list for new classes
xylar Apr 8, 2021
905be4f
Update provenance for new classes
xylar Apr 9, 2021
41fc33b
Update setup for new classes
xylar Apr 9, 2021
467ec60
Update clean for new classes
xylar Apr 9, 2021
5681d45
Update suite for new classes
xylar Apr 9, 2021
99f794c
Simplify import in __main__.py
xylar Apr 9, 2021
8e69cbc
Move namelists and streams gen into Step
xylar Apr 9, 2021
6fbc5e7
Update model for new classes
xylar Apr 9, 2021
e8b2e51
Include parent in base class constructors
xylar Apr 9, 2021
5e19459
Improve docstrings for the new classes
xylar Apr 9, 2021
13db2b7
Make subdirs the keys for test case dicts
xylar Apr 9, 2021
8713615
Add work_dir_target for input files
xylar Apr 10, 2021
d21fbc3
Convert baroclinic_channel to classes
xylar Apr 9, 2021
e8b2622
Update ice_shelf_2d and adjust_ssh for classes
xylar Apr 9, 2021
c7f4890
Update ziso with classes
xylar Apr 9, 2021
4664095
Convert global_ocean to classes
xylar Apr 10, 2021
7ae28d8
Add MpasCore child class Ocean for ocean test cases
xylar Apr 10, 2021
c67d60f
Update ocean suites for dynamic adjustment
xylar Apr 12, 2021
5061a95
Convert dome to classes
xylar Apr 11, 2021
1eb621b
Convert eismint2 to classes
xylar Apr 12, 2021
d9c3526
Convert enthalpy_benchmark to classes
xylar Apr 12, 2021
de6e951
Convert greenland to classes
xylar Apr 12, 2021
085464d
Convert hydro_radial to classes
xylar Apr 12, 2021
1022dc7
Add MpasCore child class Landice for landice test cases
xylar Apr 12, 2021
ab5b2b4
Remove examples core
xylar Apr 12, 2021
bfcee4b
Switch to explicitly adding steps, cases, groups
xylar Apr 13, 2021
4a6f840
Update Grizzly and Badger account names
xylar Apr 13, 2021
f434c06
Improve docstrings for generate methods
xylar Apr 14, 2021
e39be09
Add missing init argument to global_ocean_config calls
xylar Apr 15, 2021
14fabda
Fix MPAS-Ocean --> MALI in landice.cfg
xylar Apr 16, 2021
254ee28
Update step docstrings
xylar Apr 18, 2021
d2baca5
Move existing documentation to legacy dir
xylar Jan 11, 2021
c440018
Remove very old docs and undocumented test cases
xylar Jan 11, 2021
83e9d9b
Update reference names in legacy docs
xylar Jan 11, 2021
d76622b
Fix typo in legacy documentaition
xylar Jan 11, 2021
dc30465
Add index and quick start to new docs
xylar Jan 11, 2021
ba70fb2
Update conda env and user config file in quick start
xylar Jan 16, 2021
4bdafd7
Remove legacy index
xylar Jan 16, 2021
186421d
Add first drafts of testcase, config and suite
xylar Jan 16, 2021
f932a2f
Add ocean and landice cores overview
xylar Jan 16, 2021
340a7bb
Add user config to configuration docs
xylar Jan 16, 2021
3ed6e46
Add ref for the compass repo
xylar Jan 16, 2021
2686117
Update COMPASS --> compass in conf.py
xylar Jan 16, 2021
0d4acc8
Add baroclinic_channel config
xylar Jan 16, 2021
96aade6
Update ref names to include core prefix before configs
xylar Jan 16, 2021
de0feb3
Small tweaks to ocean configs
xylar Jan 16, 2021
0b9a105
More COMPASS --> compass
xylar Jan 16, 2021
c932dbc
Add ice_shelf_2d config
xylar Jan 17, 2021
0565fd9
Add ziso config
xylar Jan 17, 2021
14a1742
Remove unused _static setup
xylar Jan 18, 2021
775e273
Put cores into user's guide
xylar Jan 18, 2021
e832259
Add global_ocean config
xylar Jan 18, 2021
3a178a8
Add docs on ice-shelf framework
xylar Jan 19, 2021
14100a6
Add ocean framework docs on vertical coordinate
xylar Jan 19, 2021
a1de732
Add docs for ocean test suites
xylar Jan 19, 2021
f8b82bc
Add machnes overview, grizzly and badger
xylar Jan 19, 2021
ec91176
Add Anvil and stub for Chrysalis.
xylar Jan 19, 2021
c5079d6
Add stub for compy
xylar Jan 19, 2021
770bdfa
Add cori
xylar Jan 19, 2021
01e1be1
Add "unknown" linux and osx machines
xylar Jan 19, 2021
b48c477
Fix slurm URL, redundant with slurm reference
xylar Jan 19, 2021
62f0850
Add references to remaining machines.
xylar Jan 19, 2021
ab031a5
Update the index to reflect existing docs.
xylar Jan 19, 2021
33aa46b
Add API to developer's guide
xylar Jan 23, 2021
bccdc71
Reorganize the API cores
xylar Jan 23, 2021
66c68df
Update user's and developer's guides
xylar Jan 23, 2021
486962b
Ignore "generated" directories
xylar Jan 23, 2021
b816e4b
Update overview for developer's guide
xylar Jan 25, 2021
4049cc6
Add cores overview to developer's guide
xylar Jan 25, 2021
7b46dd9
Add versions
xylar Jan 25, 2021
20e3945
Add example core to docs
xylar Jan 26, 2021
cb90fd7
Remove the legacy COMPASS documentation
xylar Jan 27, 2021
b0baa14
Update API following recent framework changes
xylar Feb 7, 2021
d7f47a6
Add landice core to the user's guide
xylar Feb 7, 2021
7199ea7
Update developer's guide overview and cores...
xylar Feb 8, 2021
4a0f953
Update examples core in developer's guide...
xylar Feb 8, 2021
b47b5f8
Add code style section to developer's guide
xylar Feb 27, 2021
02ff318
Add framework to developer's guide
xylar Feb 27, 2021
0e6420c
Add docs to developer's guide
xylar Feb 27, 2021
701eecf
Add landice core to developer's guide
xylar Feb 27, 2021
20a1f0c
Add landice configurations index to developer's guide
xylar Feb 27, 2021
2127cf8
Add dome configuration to developer's guide
xylar Feb 27, 2021
e0ef163
Add landice enthalpy_benchmark to developer's guide
xylar Feb 27, 2021
37dfb93
Add ocean core and framework to developer's guide
xylar Feb 28, 2021
e7917da
Add baroclinic channel to developer's guide
xylar Feb 28, 2021
2e352ac
Add ice shelf 2d to developer's guide
xylar Feb 28, 2021
4c825e7
Add ziso to developer's guide
xylar Feb 28, 2021
6606781
Remove 42layerWOCE grid from user's guide
xylar Mar 1, 2021
e5c7c21
Update ocean suites based on global ocean reorg
xylar Mar 1, 2021
2e874e1
Add SOwISC12to60 mesh to user's guide and API
xylar Mar 4, 2021
c97bee0
Add global_ocean to developer's guide
xylar Mar 20, 2021
a09ed01
Clarify use of config file
mark-petersen Mar 12, 2021
2e60799
Rename files to be same as TOC
mark-petersen Mar 13, 2021
0b68400
Update main index for latest changes
xylar Mar 20, 2021
a5ee223
Add eismint2 config to user's and dev's guides
xylar Mar 20, 2021
696ac31
Add greenland config to user's and dev's guides
xylar Mar 20, 2021
23fa98e
Add hydro_radial config to user's and dev's guides
xylar Mar 20, 2021
153ea11
Update required dev environment
xylar Mar 23, 2021
33ecec5
Split quick start into user and developer versions
xylar Mar 28, 2021
49ba716
Update user's guide to not assume you are in the repo
xylar Mar 28, 2021
079d087
Remove examples core from the docs
xylar Apr 14, 2021
f648e1a
Update automatic API for classes
xylar Apr 14, 2021
b0ef186
Update User's Guide and Test Groups
xylar Apr 15, 2021
1018607
Add run_* functions to the API.
xylar Apr 16, 2021
37dfc6e
Update developer's guide for classes and other changes
xylar Apr 17, 2021
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
39 changes: 39 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Copyright (c) 2013-2020, Los Alamos National Security, LLC (LANS) (Ocean: LA-CC-13-047;
Land Ice: LA-CC-13-117) and the University Corporation for Atmospheric Research (UCAR).

All rights reserved.

LANS is the operator of the Los Alamos National Laboratory under Contract No.
DE-AC52-06NA25396 with the U.S. Department of Energy. UCAR manages the National
Center for Atmospheric Research under Cooperative Agreement ATM-0753581 with the
National Science Foundation. The U.S. Government has rights to use, reproduce,
and distribute this software. NO WARRANTY, EXPRESS OR IMPLIED IS OFFERED BY
LANS, UCAR OR THE GOVERNMENT AND NONE OF THEM ASSUME ANY LIABILITY FOR THE USE
OF THIS SOFTWARE. If software is modified to produce derivative works, such
modified software should be clearly marked, so as not to confuse it with the
version available from LANS and UCAR.

Additionally, redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1) Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3) None of the names of LANS, UCAR or the names of its contributors, if any, may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion MPAS-Model/ocean/develop
Submodule develop updated 1154 files
106 changes: 44 additions & 62 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ pr:

jobs:
- job:
displayName: docs
displayName: linux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python38:
nompi:
python.version: '3.8'
mpi: 'nompi'
openmpi:
python.version: '3.8'
mpi: 'openmpi'
mpich:
python.version: '3.8'
mpi: 'mpich'

steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
Expand All @@ -31,18 +38,41 @@ jobs:
eval "$(conda shell.bash hook)"
conda config --add channels conda-forge
conda config --set channel_priority strict
displayName: Configure conda
conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build
displayName: Create Anaconda build environment

- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda build -m ci/mpi_$(mpi).yaml recipe
displayName: Build COMPASS metapackage

- bash: |
set -e
eval "$(conda shell.bash hook)"
conda activate build
conda create --yes --quiet --name compass -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION compass sphinx mock sphinx_rtd_theme m2r
displayName: Create compass conda environment

- bash: |
set -e
eval "$(conda shell.bash hook)"
conda create -y -n docs python=$PYTHON_VERSION sphinx mock sphinx_rtd_theme m2r
displayName: Create docs environment
conda activate compass

compass list
compass list --machines
compass list --suites
compass list --help
compass setup --help
compass suite --help
compass clean --help
displayName: Test compass

- bash: |
set -e
eval "$(conda shell.bash hook)"
conda activate docs
conda activate compass

echo "source branch: $(Build.SourceBranch)"
echo "repository: $(Build.Repository.Name)"
Expand Down Expand Up @@ -122,60 +152,9 @@ jobs:
git push -fq origin $PUBLICATION_BRANCH
fi
popd || exit 1
condition: eq(variables['mpi'], 'mpich')
displayName: build and deploy docs

- job:
displayName: linux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
nompi:
python.version: '3.8'
mpi: 'nompi'
openmpi:
python.version: '3.8'
mpi: 'openmpi'
mpich:
python.version: '3.8'
mpi: 'mpich'

steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH

- bash: |
set -e
eval "$(conda shell.bash hook)"
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create --yes --quiet --name build python=$PYTHON_VERSION conda conda-build
displayName: Create Anaconda build environment

- bash: |
eval "$(conda shell.bash hook)"
conda activate build
conda build -m ci/mpi_$(mpi).yaml recipe
displayName: Build COMPASS metapackage

- bash: |
set -e
eval "$(conda shell.bash hook)"
conda activate build
conda create --yes --quiet --name compass -c ${CONDA_PREFIX}/conda-bld/ \
python=$PYTHON_VERSION compass
displayName: Create compass conda environment

- bash: |
set -e
eval "$(conda shell.bash hook)"
conda activate compass

./list_testcases.py -h
./setup_testcase.py -h
./clean_testcase.py -h
./manage_regression_suite.py -h
displayName: Test compass


- job:
Expand Down Expand Up @@ -225,9 +204,12 @@ jobs:
eval "$(conda shell.bash hook)"
conda activate compass

./list_testcases.py -h
./setup_testcase.py -h
./clean_testcase.py -h
./manage_regression_suite.py -h
compass list
compass list --machines
compass list --suites
compass list --help
compass setup --help
compass suite --help
compass clean --help
displayName: Test compass

7 changes: 7 additions & 0 deletions compass/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from compass.mpas_core import MpasCore
from compass.testgroup import TestGroup
from compass.testcase import TestCase
from compass.step import Step

__version_info__ = (1, 0, 0)
__version__ = '.'.join(str(vi) for vi in __version_info__)
56 changes: 56 additions & 0 deletions compass/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python

import sys
import argparse

import compass
from compass import list, setup, clean, suite


def main():
"""
Entry point for the main script ``compass``
"""

parser = argparse.ArgumentParser(
description="Perform compass operations",
usage='''
compass <command> [<args>]

The available compass commands are:
list List the available test cases
setup Set up a test case
clean Clean up a test case
suite Manage a regression test suite

To get help on an individual command, run:

compass <command> --help
''')

parser.add_argument('command', help='command to run')
parser.add_argument('-v', '--version',
action='version',
version='compass {}'.format(compass.__version__),
help="Show version number and exit")
if len(sys.argv) == 1:
parser.print_help()
sys.exit(0)

args = parser.parse_args(sys.argv[1:2])

commands = {'list': list.main,
'setup': setup.main,
'clean': clean.main,
'suite': suite.main}
if args.command not in commands:
print('Unrecognized command {}'.format(args.command))
parser.print_help()
exit(1)

# call the function associated with the requested command
commands[args.command]()


if __name__ == "__main__":
main()
90 changes: 90 additions & 0 deletions compass/clean.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import argparse
import sys
import os
import shutil

from compass.mpas_cores import get_mpas_cores
from compass import provenance


def clean_cases(tests=None, numbers=None, work_dir=None):
"""
Set up one or more test cases

Parameters
----------
tests : list of str, optional
Relative paths for a test cases to set up

numbers : list of int, optional
Case numbers to setup, as listed from ``compass list``

work_dir : str, optional
A directory that will serve as the base for creating case directories
"""

if tests is None and numbers is None:
raise ValueError('At least one of tests or numbers is needed.')

if work_dir is None:
work_dir = os.getcwd()

mpas_cores = get_mpas_cores()
all_test_cases = dict()
for mpas_core in mpas_cores:
for test_group in mpas_core.test_groups.values():
for test_case in test_group.test_cases.values():
all_test_cases[test_case.path] = test_case

test_cases = dict()
if numbers is not None:
keys = list(all_test_cases)
for number in numbers:
if number >= len(keys):
raise ValueError('test number {} is out of range. There are '
'only {} tests.'.format(number, len(keys)))
path = keys[number]
test_cases[path] = all_test_cases[path]

if tests is not None:
for path in tests:
if path not in all_test_cases:
raise ValueError('Test case with path {} is not in '
'the list of test cases'.format(path))
test_cases[path] = all_test_cases[path]

provenance.write(work_dir, test_cases)

print('Cleaning test cases:')
for path in test_cases.keys():
print(' {}'.format(path))

test_case_dir = os.path.join(work_dir, path)
try:
shutil.rmtree(test_case_dir)
except OSError:
pass


def main():
parser = argparse.ArgumentParser(
description='Clean up one or more test cases', prog='compass clean')

parser.add_argument("-t", "--test", dest="test",
help="Relative path for a test case to set up",
metavar="PATH")
parser.add_argument("-n", "--case_number", nargs='+', dest="case_num",
type=int,
help="Case number(s) to setup, as listed from "
"'compass list'. Can be a space-separated"
"list of case numbers.", metavar="NUM")
parser.add_argument("-w", "--work_dir", dest="work_dir",
help="If set, case directories are created in "
"work_dir rather than the current directory.",
metavar="PATH")
args = parser.parse_args(sys.argv[2:])
if args.test is None:
tests = None
else:
tests = [args.test]
clean_cases(tests=tests, numbers=args.case_num, work_dir=args.work_dir)
Loading