Skip to content

Commit

Permalink
Added fixes for PR. Fixes #143
Browse files Browse the repository at this point in the history
  • Loading branch information
bschroeter committed Oct 18, 2023
1 parent 6ed4cd7 commit 0b36493
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
20 changes: 15 additions & 5 deletions benchcab/data/config-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ experiment:
"US-Whs"
]

science_configuration:
science_configurations:
type: "list"
schema:
type: "dict"
Expand All @@ -43,25 +43,35 @@ realisations:
patch:
type: "dict"
required: false
patch_remove:
type: "dict"
required: false

fluxsite:
type: "dict"
required: false
schema:
multiprocessing:
type: "boolean"
required: false
pbs:
type: "dict"
schema:
ncpus:
type: "integer"
required: false
mem:
type: "integer"
type: "string"
regex: "^[0-9]+(?i)(mb|gb)$"
required: false
walltime:
type: "integer"
type: "string"
regex: "^[0-4][0-9]:[0-5][0-9]:[0-5][0-9]$"
required: false
storage:
type: "integer"
required: false
type: list
required: false
schema:
type: "string"
required: false

3 changes: 0 additions & 3 deletions benchcab/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def load_package_data(filename: str) -> dict:
# Alias yaml and yml.
ext = ext if ext != 'yaml' else 'yml'

# Make sure it is one of the supported types.
assert ext in PACKAGE_DATA_DECODERS.keys()

# Extract from the installations data directory.
raw = pkgutil.get_data('benchcab', os.path.join('data', filename)).decode('utf-8')

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name=benchcab
summary= Software to run a benchmarking suite for CABLE LSM
# version=2.0.0
version=2.0.0
description=To benchmark CABLE simulations
url=https://github.com/CABLE-LSM/benchcab
license=Apache 2.0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_read_config_fail():


def test_validate_config_valid():
"""Test validate_config() for a valid confiog file."""
"""Test validate_config() for a valid config file."""
valid_config = bu.load_package_data('test/config-valid.yml')
assert bc.validate_config(valid_config)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def test_load_package_data_fail():
"""Test load_package_data() fails as expected."""

with pytest.raises(FileNotFoundError):
missing = bu.load_package_data('config-missing.yml'), dict()
missing = bu.load_package_data('config-missing.yml')

0 comments on commit 0b36493

Please sign in to comment.