cursus.steps.configs.config_currency_conversion_step¶
Currency Conversion Configuration with Self-Contained Derivation Logic
This module implements the configuration class for SageMaker Processing steps for currency conversion, using a self-contained design where each field is properly categorized according to the three-tier design: 1. Essential User Inputs (Tier 1) - Required fields that must be provided by users 2. System Fields (Tier 2) - Fields with reasonable defaults that can be overridden 3. Derived Fields (Tier 3) - Fields calculated from other fields, private with read-only properties
- class CurrencyConversionMappingConfig(*, marketplace_id, currency_code, conversion_rate)[source]¶
Bases:
BaseModelSingle currency conversion mapping entry.
Fields are organized into three tiers: 1. Tier 1: Essential User Inputs - fields that users must explicitly provide 2. Tier 2: System Inputs with Defaults - fields with reasonable defaults that can be overridden 3. Tier 3: Derived Fields - fields calculated from other fields (private attributes with properties)
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class CurrencyConversionDictConfig(*, mappings)[source]¶
Bases:
BaseModelCurrency conversion dictionary with mappings.
Fields are organized into three tiers: 1. Tier 1: Essential User Inputs - fields that users must explicitly provide 2. Tier 2: System Inputs with Defaults - fields with reasonable defaults that can be overridden 3. Tier 3: Derived Fields - fields calculated from other fields (private attributes with properties)
- mappings: List[CurrencyConversionMappingConfig]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class CurrencyConversionConfig(*, author, bucket, role, region, service_name, pipeline_version, model_class='xgboost', current_date=<factory>, framework_version='2.1.0', py_version='py310', source_dir=None, enable_caching=False, use_secure_pypi=False, max_runtime_seconds=172800, project_root_folder, processing_instance_count=1, processing_volume_size=500, processing_instance_type_large='ml.m5.4xlarge', processing_instance_type_small='ml.m5.2xlarge', use_large_processing_instance=False, skip_volume_kms=None, processing_source_dir=None, processing_entry_point='currency_conversion.py', processing_script_arguments=None, processing_framework_version='1.2-1', currency_conversion_vars, currency_conversion_dict, job_type='training', currency_code_field=None, marketplace_id_field=None, default_currency='USD', n_workers=50, **extra_data)[source]¶
Bases:
ProcessingStepConfigBaseConfiguration for the Currency Conversion step with three-tier field categorization. Inherits from ProcessingStepConfigBase.
Fields are categorized into: - Tier 1: Essential User Inputs - Required from users - Tier 2: System Fields - Default values that can be overridden - Tier 3: Derived Fields - Private with read-only property access
This configuration follows the specification-driven approach where inputs and outputs are defined by step specifications and script contracts, not by hardcoded dictionaries.
- currency_conversion_dict: CurrencyConversionDictConfig¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': (), 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property environment_variables: Dict[str, str]¶
Generate environment variables for the currency conversion script.
- Returns:
Dictionary of environment variables
- get_environment_variables(declared_env_vars=None)[source]¶
Generate the currency-conversion env vars (the single env source; FZ 31e1d3g).
declared_env_varsis accepted for the builder’s names-driven contract but ignored — these values are all computed (JSON-encoded conversion vars/dict), so this config returns its full computed env dict regardless of the declared name set.
- classmethod validate_job_type(v)[source]¶
Validate job_type is lowercase alphanumeric (with underscores) — matches the peers’ validator (RiskTableMapping/Tabular) and the script’s choices.
- classmethod validate_entry_point_relative(v)[source]¶
Ensure processing_entry_point is a non‐empty relative path.
- validate_currency_fields()[source]¶
Ensure at least one of currency_code_field or marketplace_id_field is not None.
- get_public_init_fields()[source]¶
Override get_public_init_fields to include currency conversion specific fields.
- Returns:
Dictionary of field names to values for child initialization
- Return type:
Dict[str, Any]
- model_post_init(context, /)¶
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.