specs
The spec types in this file specify which types of objects can be added to a Registry. They are literally types, and used in type annotations on core abstractions.
Though this isn’t currently enforced by the types, objects that are Specs should be serializable to YAML format and are human readable and manageable.
Currently dicts are most often used where a Spec is required by type signatures.
Specs are always mappings. By default, specs map from an identifier string to a mapping of key-value properties of the spec; and in some specs such as ArgumentSetSpec, those values can themselves be mappings.
For developer convenience many functions support flattened specs, which have the spec identifier at the same level as the rest of the spec properties.
- class pcs.specs.ComponentSpecKeys
- CLASS_NAME = 'class_name'
- DEPENDENCIES = 'dependencies'
- FILE_PATH = 'file_path'
- IDENTIFIER = 'identifier'
- NAME = 'name'
- VERSION = 'version'
- class pcs.specs.RunCommandSpecKeys
- ARGUMENT_SET = 'argument_set'
- COMPONENT_ID = 'component'
- ENTRY_POINT = 'entry_point'
- IDENTIFIER = 'identifier'
- LOG_RETURN_VALUE = 'log_return_value'
- pcs.specs.flatten_spec(nested_spec: Mapping) Mapping
- pcs.specs.is_flat(spec: Mapping) bool
- pcs.specs.json_encode_flat_spec_field(spec: Mapping, field_name: str) Mapping
- pcs.specs.unflatten_spec(flat_spec: Mapping, preserve_inner_identifier: bool = False) Mapping
Takes a flat spec, and returns a nested spec. A nested spec is a map from the spec’s identifier to a map of the specs other key->value attributes. A flat spec moves the identifier into the inner map, essentially flattening the outer two dictionaries into a single dictionary.
- Parameters
flat_spec – a flat spec to unflatten.
preserve_inner_identifier – if true, do not delete ‘identiifer’, ‘name’, or ‘version’ keys (and their associated values) from the inner part of the nested spec that is returned. Else, do remove them, i.e., normalize the spec.
- Returns
Nested version of
flat_spec
.