Utils#

The Utils module contains functions used to provide names to nameless pipeline components inside of a group.

rename_component_incrementing(index, computed_names)[source]#

Function for generating new name for a pipeline component, that has similar name with other components in the same group.

The name is generated according to these rules:

  1. Base name is PipelineComponent.computed_name;

  2. If there are multiple components with the same name, #[NUMBER] is added to the resulting name, where NUMBER is the number of components with the same name in current service group.

Parameters:
  • index (int) – Index of the component to be renamed.

  • computed_names (List[str]) – A list of component names (or computed names).

Return type:

str

Returns:

Name for the component.

finalize_service_group(service_group, path='')[source]#

Function that iterates through a service group (and all its subgroups), finalizing component’s names and paths in it. Components are renamed only if user didn’t set a name for them. Their paths are also generated here.

Parameters:
  • service_group (ServiceGroup) – Service group to resolve name collisions in.

  • path (str) – A prefix for component paths – path of component is equal to {path}.{component.name}. Defaults to “”.

Raises:

ValueError – If multiple components have the same name assigned to them.

Return type:

None

initialize_service_states(ctx, service)[source]#

Reset ServiceState of service.

Called at the beginning of every turn for the pipeline service group.

Return type:

None