cursus.step_catalog.mapping

Step Catalog Mapping Module - Config-to-Builder Resolution and Legacy Support.

This module contains the mapping functionality extracted from StepCatalog to improve maintainability and separation of concerns. It handles: - Config-to-builder resolution - Legacy alias support - Pipeline construction interface - Registry integration for mapping operations

PHASE 1 ENHANCEMENT: Replaces StepBuilderRegistry mapping functionality.

class StepCatalogMapper(step_catalog)[source]

Bases: object

Handles all mapping operations for the Step Catalog system.

This class encapsulates the mapping logic that was previously spread across StepBuilderRegistry and provides a clean interface for config-to-builder resolution, legacy alias handling, and pipeline construction support.

LEGACY_ALIASES = {'MIMSPackaging': 'Package', 'MIMSPayload': 'Payload', 'ModelRegistration': 'Registration', 'PytorchModel': 'PyTorchModel', 'PytorchTraining': 'PyTorchTraining'}
get_builder_for_config(config, node_name=None)[source]

Map a config instance to a builder PROVIDER (callable with the assembler’s 5 kwargs).

Resolution is name-keyed (type(config).__name__ → registry canonical name); the value is currently the builder CLASS returned by load_builder_class (a class IS a provider, so behavior is unchanged — FZ 31e1d3g1 Phase 1). The annotation is provider-based so the classless end-state can return a factory without changing this contract.

Parameters:
  • config – Configuration instance (BasePipelineConfig)

  • node_name (str) – Optional DAG node name for context

Returns:

A builder provider (currently a builder class) or None if not found.

Return type:

Callable[[…], Any] | None

get_builder_for_step_type(step_type)[source]

Get the builder PROVIDER for a step type, with legacy alias + job-type variant fallback.

Returns a BuilderProvider (currently the builder class; FZ 31e1d3g1 Phase 1). Resolution is string-only (alias/variant on the step_type), unaffected by the class→provider change.

Parameters:

step_type (str) – Step type name (may be legacy alias or compound name with job type)

Returns:

Builder class type or None if not found

Return type:

Callable[[…], Any] | None

resolve_legacy_aliases(step_type)[source]

Resolve legacy aliases to canonical names.

Parameters:

step_type (str) – Step type (may be legacy alias)

Returns:

Canonical step type name

Return type:

str

is_step_type_supported(step_type)[source]

Check if step type is supported (including legacy aliases).

Parameters:

step_type (str) – Step type name

Returns:

True if supported, False otherwise

Return type:

bool

validate_builder_availability(step_types)[source]

Validate that builders are available for step types.

Parameters:

step_types (List[str]) – List of step types to validate

Returns:

Dictionary mapping step types to availability status

Return type:

Dict[str, bool]

get_config_types_for_step_type(step_type)[source]

Get possible config class names for a step type.

Parameters:

step_type (str) – Step type name

Returns:

List of possible configuration class names

Return type:

List[str]

list_supported_step_types()[source]

List all supported step types including legacy aliases.

Returns:

List of supported step type names

Return type:

List[str]

get_registry_function(func_name)[source]

Lazy load registry functions to avoid circular imports.

Parameters:

func_name (str) – Name of the registry function to load

Returns:

Registry function

validate_step_name_with_registry(step_name)[source]

Use registry system for step name validation.

Parameters:

step_name (str) – Step name to validate

Returns:

True if valid, False otherwise

Return type:

bool

class PipelineConstructionInterface(mapper)[source]

Bases: object

Pipeline construction interface for Step Catalog.

This class provides the pipeline-specific methods that were previously in StepBuilderRegistry, now integrated with the Step Catalog system.

get_builder_map()[source]

Get a complete builder map for pipeline construction.

Returns:

Dictionary mapping step types to builder classes

Return type:

Dict[str, Type]

validate_dag_compatibility(step_types)[source]

Validate DAG compatibility with available builders.

Parameters:

step_types (List[str]) – List of step types in the DAG

Returns:

Dictionary with validation results

Return type:

Dict[str, Any]

get_step_builder_suggestions(config_class_name)[source]

Get suggestions for step builders based on config class name.

Parameters:

config_class_name (str) – Configuration class name

Returns:

List of suggested step type names

Return type:

List[str]