cursus.steps.configs.config_tsa_tabular_preprocessing_step

TSA Tabular Preprocessing Configuration with Self-Contained Derivation Logic

This module implements the configuration class for SageMaker Processing steps for TSA (Temporal Self-Attention) tabular data preprocessing.

Three-tier field design:

Tier 1: Essential User Inputs — required fields provided by the caller. Tier 2: System Fields — reasonable defaults that can be overridden. Tier 3: Derived Fields — private, exposed via read-only properties.

Key divergences from the generic TabularPreprocessingConfig:
  • TSA-domain env-var fields: tsa_label_field, tsa_id_fields, tsa_date_field.

  • Preprocessor output path field: preprocessor_output_path.

  • preprocessing_environment_variables includes TSA_* keys.

  • Entry point defaults to tsa_tabular_preprocessing.py.

  • get_job_arguments() emits –label-field, –id-fields, –date-field, –preprocessor-output-path in addition to –job_type.

class TSATabularPreprocessingConfig(*, 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='tsa_tabular_preprocessing.py', processing_script_arguments=None, processing_framework_version='1.2-1', job_type, tsa_label_field=None, tsa_id_fields=None, tsa_date_field=None, preprocessor_output_path='/opt/ml/processing/output/preprocessor', train_ratio=0.7, test_val_ratio=0.5, output_format='CSV', max_workers=0, batch_size=5, optimize_memory=False, streaming_batch_size=0, enable_true_streaming=False, **extra_data)[source]

Bases: ProcessingStepConfigBase

Configuration for the TSA Tabular Preprocessing step.

Inherits from ProcessingStepConfigBase and extends it with: - TSA-domain environment variable fields (label, ID columns, date column). - Preprocessor artifact output path. - TSA-specific job arguments passed via argparse to the script.

job_type: str
tsa_label_field: str | None
tsa_id_fields: str | None
tsa_date_field: str | None
preprocessor_output_path: str
processing_entry_point: str
train_ratio: float
test_val_ratio: float
output_format: str
max_workers: int
batch_size: int
optimize_memory: bool
streaming_batch_size: int
enable_true_streaming: bool
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 full_script_path: str | None

Full resolved path to the TSA preprocessing entry-point script.

property tsa_environment_variables: Dict[str, str]

Returns the full set of environment variables required by the TSA preprocessing script, including both generic and TSA-specific knobs.

property preprocessing_environment_variables: Dict[str, str]

Alias for tsa_environment_variables (ProcessingStepHandler compatibility).

classmethod validate_entry_point_relative(v)[source]

Entry point must be a non-empty relative path.

classmethod validate_job_type(v)[source]

job_type must be lowercase alphanumeric (with underscores).

classmethod validate_ratios(v)[source]

Split ratios must be strictly between 0 and 1.

classmethod validate_output_format(v)[source]

output_format is case-sensitive per the field_validator in TabularPreprocessingConfig. Allowed: CSV / TSV / Parquet (exact case).

initialize_derived_fields()[source]

Initialise derived fields once after Pydantic validation completes.

get_public_init_fields()[source]

Return all fields needed to construct child/sibling config instances.

model_dump(**kwargs)[source]

Include derived properties in serialisation.

get_job_arguments()[source]

Returns the CLI arguments passed to the SageMaker Processing container.

Includes –job_type (standard) plus TSA-specific flags: –label-field, –id-fields, –date-field, –preprocessor-output-path.

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.