diff --git a/gui/tests/artifacts.js b/gui/tests/artifacts.js index bd59789aa0ddc414002407951d51dbf9a3f24f80..1ee3a46f3841203d2467c767d9e682fcd3e95fae 100644 --- a/gui/tests/artifacts.js +++ b/gui/tests/artifacts.js @@ -102868,47 +102868,6 @@ window.nomadArtifacts = { ] } }, - { - "authors": [ - "Sbail\u00f2, Luigi", - "Scheffler, Matthias", - "Ghiringhelli, Luca M." - ], - "email": "ghiringhelli@fhi-berlin.mpg.de", - "title": "Querying the NOMAD Archive and performing artificial-intelligence modeling", - "description": "In this tutorial, we demonstrate how to query the NOMAD Archive from the NOMAD Analytics toolkit. We then show examples of machine learning analysis performed on the retrieved data set.", - "notebook_name": "query_nomad_archive.ipynb", - "url": "https://gitlab.mpcdf.mpg.de/nomad-lab/analytics-query-nomad-archive", - "link": "https://analytics-toolkit.nomad-coe.eu/hub/user-redirect/notebooks/tutorials/query_nomad_archive.ipynb", - "link_public": "https://analytics-toolkit.nomad-coe.eu/public/user-redirect/notebooks/tutorials/query_nomad_archive.ipynb", - "updated": "2022-04-06", - "flags": { - "featured": true, - "top_of_list": false - }, - "labels": { - "application_section": [ - "Analysing the content of the Archive" - ], - "application_system": [ - "Ternaries" - ], - "category": [ - "query_tutorial" - ], - "ai_methods": [ - "Unsupervised learning", - "Supervised learning", - "Regression", - "Clustering", - "Dimension reduction", - "Random forest" - ], - "platform": [ - "jupyter" - ] - } - }, { "authors": [ "Langer, Marcel F." diff --git a/nomad/config/__init__.py b/nomad/config/__init__.py index c1851e85b2d19550a32be7c242f2af3c9aab2729..72d8617d13684e50ced6dfcc1caaedda4c37dd15 100644 --- a/nomad/config/__init__.py +++ b/nomad/config/__init__.py @@ -87,8 +87,17 @@ def _load_config_env() -> Dict[str, Any]: config_data: Dict[str, Any] = {} prefix = 'NOMAD_' for key, value in os.environ.items(): - if key.startswith(prefix) and key != 'NOMAD_CONFIG': - add_deep(config_data, key[len(prefix) :].lower(), value) + if key == 'NOMAD_CONFIG' or not key.startswith(prefix): + continue + + key = key[len(prefix) :].lower() + # Some environment variables starting with NOMAD_ are unavoidable + # in docker/kubernetes environments. We should ignore them here, + # before they cause a warning later when the config is validated. + if all([not key.startswith(field) for field in Config.__fields__.keys()]): + continue + + add_deep(config_data, key, value) return config_data diff --git a/nomad/config/models/common.py b/nomad/config/models/common.py index 6cc62bb32b3d2cb982962f7560d80c04f8889259..fa89af6ae44887d291c64ab9dd84872b0f4d52ea 100644 --- a/nomad/config/models/common.py +++ b/nomad/config/models/common.py @@ -67,7 +67,8 @@ class ConfigBaseModel(BaseModel, extra=Extra.ignore): if extra_fields: logger = logging.getLogger(__name__) logger.warning( - f'The following extra fields in the NOMAD config model "{cls.__name__}" are ignored: {list_items(extra_fields)}' + f'The following unsupported keys were found in your configuration, ' + f'e.g. nomad.yaml: {list_items(extra_fields)}.' ) return values diff --git a/ops/docker-compose/nomad-oasis/docker-compose.yaml b/ops/docker-compose/nomad-oasis/docker-compose.yaml index 87e662cd99c93dff98c2d64f692396aa6c15d829..3c418cc368fd5f95c6cf34cf0d15a33db64a9174 100644 --- a/ops/docker-compose/nomad-oasis/docker-compose.yaml +++ b/ops/docker-compose/nomad-oasis/docker-compose.yaml @@ -70,7 +70,7 @@ services: # nomad worker (processing) worker: restart: unless-stopped - image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:simplified-log-transfer + image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:latest container_name: nomad_oasis_worker environment: NOMAD_SERVICE: nomad_oasis_worker @@ -92,7 +92,7 @@ services: # nomad app (api + proxy) app: restart: unless-stopped - image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:simplified-log-transfer + image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:latest container_name: nomad_oasis_app environment: NOMAD_SERVICE: nomad_oasis_app @@ -130,7 +130,7 @@ services: # nomad remote tools hub (JupyterHUB, e.g. for AI Toolkit) north: restart: unless-stopped - image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:simplified-log-transfer + image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:latest container_name: nomad_oasis_north environment: NOMAD_SERVICE: nomad_oasis_north diff --git a/ops/kubernetes/values.yaml b/ops/kubernetes/values.yaml index 4bd569c4d8e9ca2e8f015ea6a3305303048855e3..3a07fcfb19726e1201b5e6282769fb5ebb6bb315 100644 --- a/ops/kubernetes/values.yaml +++ b/ops/kubernetes/values.yaml @@ -70,6 +70,11 @@ nomad: enabled: true hubServiceApiTokenSecret: "nomad-hub-service-api-token" + plugins: + entry_points: + exclude: + - normalizers/simulation/soap + image: tag: "prod" pullPolicy: "Always" diff --git a/tests/test_config.py b/tests/test_config.py index 9325598b7c789c4977f6281e53f4ed15bebcc78c..e6103fc7b63b1f2baeed93993d4764214bcda197 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -93,21 +93,30 @@ def test_config_success(config_dict, format, mockopen, monkeypatch): @pytest.mark.parametrize( - 'config_dict, warning', + 'config_dict, warning, formats_with_warning', [ pytest.param( - {'does': {'not': 'exist'}}, - 'The following extra fields in the NOMAD config model "Config" are ignored: "does"', - id='non-existing field', - ) + {'fs': {'does': 'not exist'}}, + 'The following unsupported keys were found in your configuration, e.g. nomad.yaml: "does".', + ['yaml', 'env'], + id='non-existing nested field', + ), + pytest.param( + {'does': 'not exist'}, + 'The following unsupported keys were found in your configuration, e.g. nomad.yaml: "does".', + ['yaml'], + id='non-existing top-level field', + ), ], ) @pytest.mark.parametrize('format', ['yaml', 'env']) -def test_config_warning(config_dict, format, warning, caplog, mockopen, monkeypatch): +def test_config_warning( + config_dict, format, warning, formats_with_warning, caplog, mockopen, monkeypatch +): """Tests that extra fields create a warning message.""" conf_yaml, conf_env = load_format(config_dict, format) load_test_config(conf_yaml, conf_env, mockopen, monkeypatch) - assert_log(caplog, 'WARNING', warning) + assert_log(caplog, 'WARNING', warning, negate=format not in formats_with_warning) @pytest.mark.parametrize( diff --git a/tests/utils.py b/tests/utils.py index 6a6a2dcab56e808d5278695d2baebe54fa196809..4a4b347d90980bd79452c3612eb1a0ec4557a4e9 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -28,7 +28,7 @@ from typing import Any, Dict, List, Union import pytest -def assert_log(caplog, level: str, event_part: str) -> LogRecord: +def assert_log(caplog, level: str, event_part: str, negate: bool = False) -> LogRecord: """ Assert whether a log message exists in the logs of the tests at a certain level. @@ -42,7 +42,7 @@ def assert_log(caplog, level: str, event_part: str) -> LogRecord: event_part : str The error message we're after. We search the logs matching level if they contain this string. - + negate: Instead asserting that the log exist, assert that it does not exist. """ match = None for record in caplog.get_records(when='call'): @@ -58,7 +58,7 @@ def assert_log(caplog, level: str, event_part: str) -> LogRecord: # No need to look for more matches since we aren't counting matches. break - assert match is not None + assert match is None if negate else match is not None return match