lbaf.Execution.lbsPhaseSpecification.PhaseSpecificationNormalizer class

Provides normalization and denormalization for PhaseSpecification where inner sets are represented as lists to improve readability in JSON or YAML

Methods

def _PhaseSpecificationNormalizer__normalize_member(self, data: typing.Union[dict, list], transform: typing.Optional[typing.Callable] = None) -> typing.Union[dict, list]
Normalize a member that can be represented as a dict where key is the item key or as a list where id is the index in the list
def denormalize(self, data: dict) -> PhaseSpecification
Create a phase specification from a normalized specification where some lists must be converted to sets.
def normalize(self, spec: PhaseSpecification) -> dict
Normalize a phase specification to represent inner sets as lists

Method documentation

def lbaf.Execution.lbsPhaseSpecification.PhaseSpecificationNormalizer.denormalize(self, data: dict) -> PhaseSpecification

Create a phase specification from a normalized specification where some lists must be converted to sets.

Detail: the following lists will be converted to sets to ensure each element is unique - `data.shared_blocks.tasks` - `data.ranks.tasks` - `data.ranks.communications`

This method should be called after json or yaml deserialization. This is the reverse implementation of the normalize method.

def lbaf.Execution.lbsPhaseSpecification.PhaseSpecificationNormalizer.normalize(self, spec: PhaseSpecification) -> dict

Normalize a phase specification to represent inner sets as lists

Note: the sets converted to lists are - `self.shared_blocks.tasks` - `self.ranks.tasks` - `self.ranks.communications`

This method should be called before json or yaml serialization. Denormalization should be executed using the method denormalize

Note: the normalized specification data is easier to read and edit in json or yaml.