cursus.registry¶
Enhanced Pipeline Registry Module with Hybrid Registry Support.
This module contains registry components for tracking step types, specifications, hyperparameters, and other metadata used in the pipeline system. It helps ensure consistency in step naming and configuration.
Enhanced Features: - Workspace-aware step resolution - Hybrid registry backend support - Context management for multi-developer workflows - Backward compatibility with existing code
- exception RegistryError(message, unresolvable_types=None, available_builders=None)[source]¶
Bases:
ExceptionRaised when step builder registry errors occur.
- class KnobSpec(name, type='str', default=None, required=False, doc='')[source]¶
Bases:
objectDescribes one tunable knob a handler accepts.
- class StrategyInfo(axis, name, handler, knobs=(), preset_knobs=<factory>, routable=True, verb='', implemented=True)[source]¶
Bases:
objectA registry row: a routing (axis, name) -> a handler class + its knobs.
- exception NoBuilderError[source]¶
Bases:
ValueErrorRaised when an (axis, name) has no routable strategy (abstract / builder-less type).
- register_strategy(*, axis, name, knobs=(), preset_knobs=None, routable=True, verb='', implemented=True)[source]¶
Decorator: register a handler class under (axis, name). Returns the class unchanged.
- register_no_builder(*, axis, name, verb='')[source]¶
Register a non-routable row (e.g. Base / Lambda — abstract or builder-less types).
- resolve_strategy(axis, name)[source]¶
Return the routable StrategyInfo for (axis, name), else raise NoBuilderError.
- axis_name_for_step_type(sagemaker_step_type, step_assembly=None)[source]¶
Map a step’s (sagemaker_step_type, step_assembly) onto the registry
(axis, name)key.This is the single source of the routing rule —
builder_templates.resolve_handlercalls it to bind the handler at build time, and the introspection tool calls it forfor_step_type— so the tool’s “what would this step bind?” answer can never diverge from the actual router.Routing is by
sagemaker_step_typeONLY (never by step name);Processingis the one type sub-discriminated bystep_assembly(code|step_args|delegation, defaultcode).
- find_strategies(name, axis=None)[source]¶
All registered strategies whose
namematches, optionally constrained to oneaxis.Names are unique within an axis but a bare name may (in principle) appear on more than one axis, so callers that need exactly one row should disambiguate with
axis.
- strategy_to_dict(info)[source]¶
A StrategyInfo as a plain, JSON-serializable dict (handler rendered as its class name).
- get_config_class_name(step_name, workspace_id=None)[source]¶
Get config class name with workspace context.
- get_builder_step_name(step_name, workspace_id=None)[source]¶
Get builder step class name with workspace context.
- get_spec_step_type(step_name, workspace_id=None)[source]¶
Get step_type value for StepSpecification with workspace context.
- get_spec_step_type_with_job_type(step_name, job_type=None, workspace_id=None)[source]¶
Get step_type with optional job_type suffix, workspace-aware.
- get_step_name_from_spec_type(spec_type, workspace_id=None)[source]¶
Get canonical step name from spec_type with workspace context.
- validate_step_name(step_name, workspace_id=None)[source]¶
Validate step name exists with workspace context.
- validate_spec_type(spec_type, workspace_id=None)[source]¶
Validate spec_type exists with workspace context.
- get_step_description(step_name, workspace_id=None)[source]¶
Get step description with workspace context.
- list_all_step_info(workspace_id=None)[source]¶
Get complete step information with workspace context.
- get_sagemaker_step_type(step_name, workspace_id=None)[source]¶
Get SageMaker step type with workspace context.
- get_steps_by_sagemaker_type(sagemaker_type, workspace_id=None)[source]¶
Get steps by SageMaker type with workspace context.
- get_all_sagemaker_step_types(workspace_id=None)[source]¶
Get all SageMaker step types with workspace context.
- validate_sagemaker_step_type(sagemaker_type, workspace_id=None)[source]¶
Validate SageMaker step type against the single-source valid set.
- get_sagemaker_step_type_mapping(workspace_id=None)[source]¶
Get SageMaker step type mapping with workspace context.
- get_canonical_name_from_file_name(file_name, workspace_id=None)[source]¶
Enhanced file name resolution with workspace context awareness.
- Parameters:
- Returns:
Canonical step name (e.g., “XGBoostModelEval”, “DummyTraining”)
- Raises:
ValueError – If file name cannot be mapped to a canonical name
- Return type:
- validate_file_name(file_name, workspace_id=None)[source]¶
Validate file name can be mapped with workspace context.
- get_workspace_context()[source]¶
Get current workspace context.
- Returns:
Current workspace identifier or None if no context set
- Return type:
str | None
- workspace_context(workspace_id)[source]¶
Context manager for temporary workspace context.
- Parameters:
workspace_id (str) – Workspace identifier for temporary context
- Usage:
- with workspace_context(“developer_1”):
step_names = get_step_names() # Uses developer_1 context
- get_config_step_registry(workspace_id=None)[source]¶
Get CONFIG_STEP_REGISTRY with workspace context.
- class UnifiedRegistryManager(core_registry_path=None, workspaces_root=None)[source]¶
Bases:
objectUnified registry manager that consolidates all registry operations.
Replaces CoreStepRegistry, LocalStepRegistry, and HybridRegistryManager with a single, efficient manager that eliminates redundancy while maintaining all functionality.
- create_legacy_step_names_dict(workspace_id=None)[source]¶
Create legacy STEP_NAMES dictionary for backward compatibility with caching.
- get_all_step_definitions(workspace_id=None)[source]¶
Get all step definitions with caching for performance optimization.
- get_local_only_definitions(workspace_id)[source]¶
Get only local and override definitions for a workspace (not core).
- get_step(step_name, context=None)[source]¶
Get a step definition with simple workspace priority resolution.
- Parameters:
step_name (str) – Name of the step to retrieve
context (ResolutionContext | None) – Resolution context for workspace handling
- Returns:
StepResolutionResult containing the resolved step and metadata
- Return type:
- get_step_definition(step_name, workspace_id=None)[source]¶
Get a step definition by name, with optional workspace context.
- Parameters:
- Returns:
StepDefinition if found, None otherwise
- Return type:
StepDefinition | None
- reload_core_registry()[source]¶
Re-snapshot the core registry from
step_names_base.STEP_NAMESand drop caches.Called after an external step-pack merges rows into
step_names_base(seecursus.registry.step_names.refresh_registry()) so the manager’s_core_stepssnapshot and its legacy/definition caches reflect the plugin steps. Additive by construction — it re-reads the (already package-first-merged) base table.
- class StepDefinition(*, name, registry_type, config_class=None, spec_type=None, sagemaker_step_type=None, builder_step_name=None, description=None, framework=None, job_types=<factory>, workspace_id=None, override_source=None, priority=100, compatibility_tags=<factory>, framework_version=None, environment_tags=<factory>, conflict_resolution_strategy=ResolutionStrategy.WORKSPACE_PRIORITY, metadata=<factory>)[source]¶
Bases:
BaseModelEnhanced step definition with registry metadata using Pydantic V2 and enum validation.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False, 'str_strip_whitespace': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- registry_type: RegistryType¶
- conflict_resolution_strategy: ResolutionStrategy¶
- class ResolutionContext(*, workspace_id=None, preferred_framework=None, environment_tags=<factory>, resolution_mode=ResolutionMode.AUTOMATIC, resolution_strategy=ResolutionStrategy.WORKSPACE_PRIORITY)[source]¶
Bases:
BaseModelContext for step resolution and conflict resolution using Pydantic V2 and enum validation.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- resolution_mode: ResolutionMode¶
- resolution_strategy: ResolutionStrategy¶
- class StepResolutionResult(**data)[source]¶
Bases:
BaseModelResult of step conflict resolution using Pydantic V2.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- selected_definition: StepDefinition | None¶
- conflicting_definitions: List[StepDefinition]¶
- conflict_analysis: ConflictAnalysis | None¶
- class RegistryValidationResult(*, is_valid, registry_type='unknown', issues=<factory>, errors=<factory>, warnings=<factory>, step_count=0, **extra_data)[source]¶
Bases:
BaseModelResults of registry validation using Pydantic V2.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ConflictAnalysis(*, step_name, conflicting_definitions=<factory>, resolution_strategies=<factory>, recommended_strategy=None, impact_assessment=None, conflicting_sources, resolution_strategy, workspace_context=None, conflict_type='name_conflict', **extra_data)[source]¶
Bases:
BaseModelAnalysis of a step name conflict using Pydantic V2.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- conflicting_definitions: List[StepDefinition]¶
- class RegistryType(*values)[source]¶
-
Registry type enumeration for automatic validation.
- CORE = 'core'¶
- WORKSPACE = 'workspace'¶
- OVERRIDE = 'override'¶
- class ResolutionMode(*values)[source]¶
-
Resolution mode enumeration for automatic validation.
- AUTOMATIC = 'automatic'¶
- INTERACTIVE = 'interactive'¶
- STRICT = 'strict'¶
- class ResolutionStrategy(*values)[source]¶
-
Resolution strategy enumeration for automatic validation.
- WORKSPACE_PRIORITY = 'workspace_priority'¶
- FRAMEWORK_MATCH = 'framework_match'¶
- ENVIRONMENT_MATCH = 'environment_match'¶
- MANUAL = 'manual'¶
- HIGHEST_PRIORITY = 'highest_priority'¶
- CORE_FALLBACK = 'core_fallback'¶
- class ConflictType(*values)[source]¶
-
Conflict type enumeration for automatic validation.
- NAME_CONFLICT = 'name_conflict'¶
- FRAMEWORK_CONFLICT = 'framework_conflict'¶
- VERSION_CONFLICT = 'version_conflict'¶
- WORKSPACE_CONFLICT = 'workspace_conflict'¶
- switch_to_workspace(workspace_id)[source]¶
Switch to a specific workspace context.
- Parameters:
workspace_id (str) – Workspace identifier to switch to
Example
switch_to_workspace(“developer_1”) step_names = STEP_NAMES # Now uses developer_1 context
- switch_to_core()[source]¶
Switch back to core registry (no workspace context).
Example
switch_to_core() step_names = STEP_NAMES # Now uses core registry only
- get_registry_info(workspace_id=None)[source]¶
Get comprehensive registry information for a workspace or core.
Modules
Exception classes for the Pipeline Registry. |
|
Phase 3: Simplified Local Registry Infrastructure |
|
Interface-derived step registry loader — the SOLE source of the step-name registry. |
|
Enhanced step names registry with hybrid backend support. |
|
Base step-name registry — the single source of truth for step naming across config, builders, and specifications. |
|
Strategy registry — the single source of truth for the builder strategy library. |
|
Simple validation utilities for step definition standardization. |