RuntimeBase

class tolteca.utils.RuntimeBase(config)[source]

Bases: object

A base class that consumes RuntimeContext.

This class acts as a proxy of an underlying RuntimeContext object, providing a unified interface for subclasses to managed specialized config objects constructed from the config dict of the runtime context and its the runtime info.

Parameters
configRuntimeContext, pathlib.Path, str, dict

The runtime context object, or the config source of it.

Attributes Summary

config

The config object of config_cls constructed from the runtime context config dict.

config_cls

Subclasses implement this to provide specialized config object.

rc

Methods Summary

update(config[, mode])

Update the config object with provided config dict.

yaml_dump(config[, output])

Dump config as YAML to output

yaml_load(stream)

Attributes Documentation

config

The config object of config_cls constructed from the runtime context config dict.

The config dict is validated and the constructed object is cached. The config object can be updated by using RuntimeBase.update().

config_cls = NotImplemented

Subclasses implement this to provide specialized config object.

rc

Methods Documentation

update(config, mode='override')[source]

Update the config object with provided config dict.

Parameters
configdict

The config dict to apply.

mode{“override”, “default”}

Controls how config dict is applied, Wether to override the config or use as default for unspecified values.

classmethod yaml_dump(config, output=None)

Dump config as YAML to output

Parameters
configdict

The config to write.

outputio.StringIO, optional

The object to write to. If None, return the YAML as string.

classmethod yaml_load(stream)