climate-ref-core 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- climate_ref_core/exceptions.py +8 -0
- climate_ref_core/executor.py +9 -3
- {climate_ref_core-0.6.0.dist-info → climate_ref_core-0.6.1.dist-info}/METADATA +1 -1
- {climate_ref_core-0.6.0.dist-info → climate_ref_core-0.6.1.dist-info}/RECORD +7 -7
- {climate_ref_core-0.6.0.dist-info → climate_ref_core-0.6.1.dist-info}/WHEEL +0 -0
- {climate_ref_core-0.6.0.dist-info → climate_ref_core-0.6.1.dist-info}/licenses/LICENCE +0 -0
- {climate_ref_core-0.6.0.dist-info → climate_ref_core-0.6.1.dist-info}/licenses/NOTICE +0 -0
climate_ref_core/exceptions.py
CHANGED
|
@@ -53,3 +53,11 @@ class ExecutionError(RefException):
|
|
|
53
53
|
|
|
54
54
|
def __init__(self, message: str) -> None:
|
|
55
55
|
super().__init__(message)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class DiagnosticError(RefException):
|
|
59
|
+
"""Error from diagnostic computing"""
|
|
60
|
+
|
|
61
|
+
def __init__(self, message: str, result: Any):
|
|
62
|
+
super().__init__(message)
|
|
63
|
+
self.result = result
|
climate_ref_core/executor.py
CHANGED
|
@@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
|
|
|
9
9
|
from loguru import logger
|
|
10
10
|
|
|
11
11
|
from climate_ref_core.diagnostics import ExecutionDefinition, ExecutionResult
|
|
12
|
-
from climate_ref_core.exceptions import InvalidExecutorException
|
|
12
|
+
from climate_ref_core.exceptions import DiagnosticError, InvalidExecutorException
|
|
13
13
|
from climate_ref_core.logging import redirect_logs
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
@@ -20,6 +20,7 @@ if TYPE_CHECKING:
|
|
|
20
20
|
def execute_locally(
|
|
21
21
|
definition: ExecutionDefinition,
|
|
22
22
|
log_level: str,
|
|
23
|
+
raise_error: bool = False,
|
|
23
24
|
) -> ExecutionResult:
|
|
24
25
|
"""
|
|
25
26
|
Run a diagnostic execution
|
|
@@ -46,10 +47,15 @@ def execute_locally(
|
|
|
46
47
|
|
|
47
48
|
with redirect_logs(definition, log_level):
|
|
48
49
|
return definition.diagnostic.run(definition=definition)
|
|
49
|
-
except Exception:
|
|
50
|
+
except Exception as e:
|
|
50
51
|
# If the diagnostic fails, we want to log the error and return a failure result
|
|
51
52
|
logger.exception(f"Error running {definition.execution_slug()!r}")
|
|
52
|
-
|
|
53
|
+
result = ExecutionResult.build_from_failure(definition)
|
|
54
|
+
|
|
55
|
+
if raise_error:
|
|
56
|
+
raise DiagnosticError(str(e), result) from e
|
|
57
|
+
else:
|
|
58
|
+
return result
|
|
53
59
|
|
|
54
60
|
|
|
55
61
|
@runtime_checkable
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: climate-ref-core
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: Core library for the CMIP Rapid Evaluation Framework
|
|
5
5
|
Author-email: Jared Lewis <jared.lewis@climate-resource.com>, Mika Pflueger <mika.pflueger@climate-resource.com>, Bouwe Andela <b.andela@esciencecenter.nl>, Jiwoo Lee <lee1043@llnl.gov>, Min Xu <xum1@ornl.gov>, Nathan Collier <collierno@ornl.gov>, Dora Hegedus <dora.hegedus@stfc.ac.uk>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -4,8 +4,8 @@ climate_ref_core/dataset_registry.py,sha256=mkes7Pgz_zaS_t_BidiDzSd8dmqAvjx2Mlgo
|
|
|
4
4
|
climate_ref_core/datasets.py,sha256=TK50WQwTfbase26s8wPEGEN1BwcedrOd8nk6IlEf3Ww,6124
|
|
5
5
|
climate_ref_core/diagnostics.py,sha256=5KCtHuhToSpATqjW4HBi56PsOxT5WX4VkqoZPUvYR60,18769
|
|
6
6
|
climate_ref_core/env.py,sha256=Ph2dejVxTELfP3bL0xES086WLGvV5H6KvsOwCkL6m-k,753
|
|
7
|
-
climate_ref_core/exceptions.py,sha256=
|
|
8
|
-
climate_ref_core/executor.py,sha256=
|
|
7
|
+
climate_ref_core/exceptions.py,sha256=aC_wohLCjOUarZM2VvpGdJzPvYdT31h_MRVbqVk-MIk,1633
|
|
8
|
+
climate_ref_core/executor.py,sha256=QiVOca-d9JxKIktQIinQQYZGr3ecV5mL3nvUwCdMiJQ,5372
|
|
9
9
|
climate_ref_core/logging.py,sha256=cg6CK2DHGjyLaoRJm75p-Ja82hnVhBBQ4riOKk3l9XY,7063
|
|
10
10
|
climate_ref_core/providers.py,sha256=by_ZtoLQgg9A60CbFor2-i5EixtZTZ0z8jQqOGRfvA8,12461
|
|
11
11
|
climate_ref_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -17,8 +17,8 @@ climate_ref_core/pycmec/controlled_vocabulary.py,sha256=ThdTBsSmUemyXSQG5RycN31q
|
|
|
17
17
|
climate_ref_core/pycmec/cv_cmip7_aft.yaml,sha256=gx5QyW88pZQVUfiYXmsJtJO6AJg6NbIZgdU4vDIa3fE,4390
|
|
18
18
|
climate_ref_core/pycmec/metric.py,sha256=zymXoutnjbdcxvG_fMJugFLLcBrfSPG0XoV-2tA0ujA,18499
|
|
19
19
|
climate_ref_core/pycmec/output.py,sha256=4-RQ439sfgNLeQZVDPB1pewF_kTwX7nCK0Z4U6bvbd0,5709
|
|
20
|
-
climate_ref_core-0.6.
|
|
21
|
-
climate_ref_core-0.6.
|
|
22
|
-
climate_ref_core-0.6.
|
|
23
|
-
climate_ref_core-0.6.
|
|
24
|
-
climate_ref_core-0.6.
|
|
20
|
+
climate_ref_core-0.6.1.dist-info/METADATA,sha256=fVjjH-4zZEbuoFw47Sqo1TRFAWwwiz6BZetTD88xQLE,2934
|
|
21
|
+
climate_ref_core-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
22
|
+
climate_ref_core-0.6.1.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
23
|
+
climate_ref_core-0.6.1.dist-info/licenses/NOTICE,sha256=4qTlax9aX2-mswYJuVrLqJ9jK1IkN5kSBqfVvYLF3Ws,128
|
|
24
|
+
climate_ref_core-0.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|