src.util.exceptions module

All framework-specific exceptions are placed in a single module to simplify imports.

src.util.exceptions.exit_on_exception(exc, msg=None)[source]

Prints information about a fatal exception to the console beofre exiting. Use case is in user-facing subcommands (mdtf install etc.), since we have more sophisticated logging in the framework itself. :param exc: Exception object :param msg: additional message to print. :type msg: str, optional

src.util.exceptions.chain_exc(exc, new_msg, new_exc_class=None)[source]
src.util.exceptions.exc_descriptor(exc)[source]
exception src.util.exceptions.TimeoutAlarm[source]

Bases: Exception

Dummy exception raised if a subprocess times out.

exception src.util.exceptions.MDTFBaseException[source]

Bases: Exception

Base class to describe all MDTF-specific errors that can happen during the framework’s operation.

exception src.util.exceptions.ChildFailureEvent(obj)[source]

Bases: src.util.exceptions.MDTFBaseException

Exception raised when a member of the object hierarchy is deactivated because all its child objects have failed.

exception src.util.exceptions.PropagatedEvent(exc, parent)[source]

Bases: src.util.exceptions.MDTFBaseException

Exception passed between members of the object hierarchy when a parent object (MDTFObjectBase) has been deactivated and needs to deactivate its children.

exception src.util.exceptions.MDTFFileNotFoundError(path)[source]

Bases: FileNotFoundError, src.util.exceptions.MDTFBaseException

Wrapper for FileNotFoundError which handles error codes so we don’t have to remember to import errno everywhere.

exception src.util.exceptions.MDTFFileExistsError(path)[source]

Bases: FileExistsError, src.util.exceptions.MDTFBaseException

Wrapper for FileExistsError which handles error codes so we don’t have to remember to import errno everywhere.

exception src.util.exceptions.MDTFCalledProcessError(returncode, cmd, output=None, stderr=None)[source]

Bases: subprocess.CalledProcessError, src.util.exceptions.MDTFBaseException

Wrapper for subprocess.CalledProcessError.

exception src.util.exceptions.WormKeyError[source]

Bases: KeyError, src.util.exceptions.MDTFBaseException

Raised when attempting to overwrite or delete an entry in a WormDict.

exception src.util.exceptions.DataclassParseError[source]

Bases: ValueError, src.util.exceptions.MDTFBaseException

Raised when parsing input data fails on a mdtf_dataclass() or regex_dataclass().

exception src.util.exceptions.RegexParseError[source]

Bases: ValueError, src.util.exceptions.MDTFBaseException

Raised when parsing input data fails on a RegexPattern().

exception src.util.exceptions.RegexSuppressedError[source]

Bases: ValueError, src.util.exceptions.MDTFBaseException

Raised when parsing input data fails on a RegexPattern(), but we’ve decided to supress error based on the associated RegexPattern’s match_error_filter attribute.

exception src.util.exceptions.UnitsError[source]

Bases: ValueError, src.util.exceptions.MDTFBaseException

Raised when trying to convert between quantities with physically inequivalent units.

exception src.util.exceptions.ConventionError(conv_name)[source]

Bases: src.util.exceptions.MDTFBaseException

Exception raised by a duplicate variable convention name.

exception src.util.exceptions.MixedDatePrecisionException(func_name='', msg='')[source]

Bases: src.util.exceptions.MDTFBaseException

Exception raised when we attempt to operate on Date or DateRange objects with differing levels of precision, which shouldn’t happen with data sampled at a single frequency.

exception src.util.exceptions.FXDateException(func_name='', msg='')[source]

Bases: src.util.exceptions.MDTFBaseException

Exception raised when FXDate or FXDateRange classes, which are placeholder/sentinel classes used to indicate static data with no time dependence, are accessed like real Date or DateRange objects.

exception src.util.exceptions.DataRequestError[source]

Bases: src.util.exceptions.MDTFBaseException

Dummy class used for fatal errors that take place during the data query/fetch/preprocess stage of the framework.

exception src.util.exceptions.MDTFEvent[source]

Bases: src.util.exceptions.MDTFBaseException

Dummy class to denote non-fatal errors, specifically “events” that are passed during the data query/fetch/preprocess stage of the framework.

exception src.util.exceptions.FatalErrorEvent[source]

Bases: src.util.exceptions.MDTFBaseException

Dummy class used to “convert” MDTFEvents to fatal errors (resulting in deactivation of a variable, pod or case.) via exception chaining.

exception src.util.exceptions.DataProcessingEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.MDTFEvent

Base class and common formatting code for events raised in data query/fetch. These should not be used for fatal errors (when a variable or POD is deactivated.)

exception src.util.exceptions.DataQueryEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.DataProcessingEvent

Exception signaling a failure to find requested data in the remote location.

exception src.util.exceptions.DataExperimentEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.DataProcessingEvent

Exception signaling a failure to uniquely select an experiment for all variables based on query results.

exception src.util.exceptions.DataFetchEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.DataProcessingEvent

Exception signaling a failure to obtain data from the remote location.

exception src.util.exceptions.DataPreprocessEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.DataProcessingEvent

Exception signaling an error in preprocessing data after it’s been fetched, but before any PODs run.

exception src.util.exceptions.MetadataEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.DataProcessingEvent

Exception signaling discrepancies in variable metadata.

exception src.util.exceptions.MetadataError[source]

Bases: src.util.exceptions.MDTFBaseException

Exception signaling unrecoverable errors in variable metadata.

exception src.util.exceptions.UnitsUndefinedError[source]

Bases: src.util.exceptions.MetadataError

Exception signaling unrecoverable errors in variable metadata.

exception src.util.exceptions.GenericDataSourceEvent(msg='', dataset=None)[source]

Bases: src.util.exceptions.DataProcessingEvent

Exception signaling a failure originating in the DataSource query/fetch pipeline whose cause doesn’t fall into the above categories.

exception src.util.exceptions.PodExceptionBase(msg=None, pod=None)[source]

Bases: src.util.exceptions.MDTFBaseException

Base class and common formatting code for exceptions affecting a single POD.

_error_str = ''
exception src.util.exceptions.PodConfigError(msg=None, pod=None)[source]

Bases: src.util.exceptions.PodExceptionBase

Exception raised if we can’t parse info in a POD’s settings.jsonc file. (Covers issues with the file format/schema; malformed JSONC will raise a JSONDecodeError when parse_json() attempts to parse the file.

_error_str = "Couldn't parse the settings.jsonc file"
exception src.util.exceptions.PodConfigEvent[source]

Bases: src.util.exceptions.MDTFEvent

Exception raised during non-fatal events in resolving POD configuration.

exception src.util.exceptions.PodDataError(msg=None, pod=None)[source]

Bases: src.util.exceptions.PodExceptionBase

Exception raised if POD doesn’t have required data to run.

_error_str = 'Requested data not available'
exception src.util.exceptions.PodRuntimeError(msg=None, pod=None)[source]

Bases: src.util.exceptions.PodExceptionBase

Exception raised if POD doesn’t have required resources to run.

_error_str = 'Error in setting the runtime environment'
exception src.util.exceptions.PodExecutionError(msg=None, pod=None)[source]

Bases: src.util.exceptions.PodExceptionBase

Exception raised if POD exits with non-zero retcode or otherwise raises an error during execution.

_error_str = 'Error during POD execution'