Skip to content

Demand Model

Data models for demand execution operations.


Demand execution data models.

Defines the request, response, and configuration models for demand execution scaffolding and management.

ContextManagerConfiguration dataclass

ContextManagerConfiguration(
    isolate_inputs=custom_field(default=True),
    cleanup_inputs=custom_field(default=True),
    cleanup_working_dir=custom_field(default=True),
    env_file_write_mode=custom_field(
        mm_field=(EnumField(EnvFileWriteMode)),
        default=(EnvFileWriteMode.ALWAYS),
    ),
    input_data_sync_configuration=custom_field(
        default_factory=DataSyncConfiguration,
        mm_field=(DataSyncConfiguration.as_mm_field()),
    ),
    output_data_sync_configuration=custom_field(
        default_factory=DataSyncConfiguration,
        mm_field=(DataSyncConfiguration.as_mm_field()),
    ),
)

Bases: SchemaModel

Configuration for demand execution context management.

Controls behavior of input/output handling, cleanup, and environment variable management.

Attributes:

Name Type Description
isolate_inputs bool

If True, copy inputs to working directory instead of using shared scratch. Useful for mutable inputs.

cleanup_inputs bool

If True, remove input data after execution.

cleanup_working_dir bool

If True, remove working directory after execution.

env_file_write_mode EnvFileWriteMode

How to handle environment variable files.

input_data_sync_configuration DataSyncConfiguration

Configuration for input data sync.

output_data_sync_configuration DataSyncConfiguration

Configuration for output data sync.

DataSyncConfiguration dataclass

DataSyncConfiguration(
    temporary_request_payload_path=custom_field(
        default=None, mm_field=(S3Path.as_mm_field())
    ),
    force=custom_field(default=False),
    size_only=custom_field(default=True),
)

Bases: SchemaModel

Configuration for data synchronization behavior.

Controls how data is synced between S3 and EFS for demand executions.

Attributes:

Name Type Description
temporary_request_payload_path Optional[S3Path]

Optional S3 path for storing large request payloads that exceed state machine limits.

force bool

If True, sync data even if it already exists and passes checksum/size validation.

size_only bool

If True, only check file sizes when validating sync. If False, also verify checksums.

DemandExecutionCleanupConfigs dataclass

DemandExecutionCleanupConfigs(
    data_sync_requests=custom_field(
        mm_field=(
            UnionField(
                [
                    (
                        list,
                        ListField(
                            PrepareBatchDataSyncRequest.as_mm_field()
                        ),
                    ),
                    (
                        list,
                        ListField(
                            DataSyncRequest.as_mm_field()
                        ),
                    ),
                ]
            )
        )
    ),
    remove_data_paths_requests=custom_field(
        mm_field=(
            ListField(RemoveDataPathsRequest.as_mm_field())
        ),
        default_factory=list,
    ),
)

Bases: SchemaModel

Cleanup configurations generated for a demand execution.

Contains the data sync requests and path removal requests to execute after the demand execution completes.

Attributes:

Name Type Description
data_sync_requests List[Union[DataSyncRequest, PrepareBatchDataSyncRequest]]

Requests for syncing output data.

remove_data_paths_requests List[RemoveDataPathsRequest]

Requests to remove temporary data.

DemandExecutionSetupConfigs dataclass

DemandExecutionSetupConfigs(
    data_sync_requests=custom_field(
        mm_field=(
            UnionField(
                [
                    (
                        list,
                        ListField(
                            PrepareBatchDataSyncRequest.as_mm_field()
                        ),
                    ),
                    (
                        list,
                        ListField(
                            DataSyncRequest.as_mm_field()
                        ),
                    ),
                ]
            )
        )
    ),
    batch_create_request=custom_field(
        mm_field=(
            CreateDefinitionAndPrepareArgsRequest.as_mm_field()
        )
    ),
)

Bases: SchemaModel

Setup configurations generated for a demand execution.

Contains the data sync requests and batch job configuration needed to run the demand execution.

Attributes:

Name Type Description
data_sync_requests List[Union[DataSyncRequest, PrepareBatchDataSyncRequest]]

Requests for syncing input data.

batch_create_request CreateDefinitionAndPrepareArgsRequest

Request to create the batch job.

DemandFileSystemConfigurations dataclass

DemandFileSystemConfigurations(
    shared=custom_field(
        mm_field=(FileSystemConfiguration.as_mm_field()),
        default_factory=FileSystemConfiguration,
    ),
    scratch=custom_field(
        mm_field=(FileSystemConfiguration.as_mm_field()),
        default_factory=FileSystemConfiguration,
    ),
    tmp=custom_field(
        mm_field=(FileSystemConfiguration.as_mm_field()),
        default=None,
    ),
)

Bases: SchemaModel

Collection of file system configurations for demand execution.

Attributes:

Name Type Description
shared FileSystemConfiguration

Configuration for the shared/input volume (read-only).

scratch FileSystemConfiguration

Configuration for the scratch/working volume (read-write).

tmp Optional[FileSystemConfiguration]

Optional configuration for a dedicated tmp volume.

EnvFileWriteMode

Bases: str, Enum

Modes for writing environment files in batch jobs.

Controls whether environment variables are written to a file on EFS or passed directly to the container.

Attributes:

Name Type Description
NEVER

Never write env file, always pass variables directly.

ALWAYS

Always write env file to avoid variable size limits.

IF_REQUIRED

Write env file only if variables exceed size threshold.

FileSystemConfiguration dataclass

FileSystemConfiguration(
    file_system=None, access_point=None, container_path=None
)

Bases: SchemaModel

Configuration for an EFS file system mount.

Attributes:

Name Type Description
file_system Optional[str]

Optional file system ID or name.

access_point Optional[str]

Optional access point ID or name.

container_path Optional[str]

Optional custom container mount path.

PrepareDemandScaffoldingRequest dataclass

PrepareDemandScaffoldingRequest(
    demand_execution=custom_field(
        mm_field=(DemandExecution.as_mm_field())
    ),
    file_system_configurations=custom_field(
        mm_field=(
            DemandFileSystemConfigurations.as_mm_field()
        ),
        default_factory=DemandFileSystemConfigurations,
    ),
    context_manager_configuration=custom_field(
        mm_field=(
            ContextManagerConfiguration.as_mm_field()
        ),
        default_factory=ContextManagerConfiguration,
    ),
)

Bases: SchemaModel

Request for preparing demand execution scaffolding.

Attributes:

Name Type Description
demand_execution DemandExecution

The demand execution to prepare infrastructure for.

file_system_configurations DemandFileSystemConfigurations

EFS mount configurations.

context_manager_configuration ContextManagerConfiguration

Execution context settings.

PrepareDemandScaffoldingResponse dataclass

PrepareDemandScaffoldingResponse(
    demand_execution=custom_field(
        mm_field=(DemandExecution.as_mm_field())
    ),
    setup_configs=custom_field(
        mm_field=(DemandExecutionSetupConfigs.as_mm_field())
    ),
    cleanup_configs=custom_field(
        mm_field=(
            DemandExecutionCleanupConfigs.as_mm_field()
        )
    ),
)

Bases: SchemaModel

Response from preparing demand execution scaffolding.

Attributes:

Name Type Description
demand_execution DemandExecution

The updated demand execution with resolved paths.

setup_configs DemandExecutionSetupConfigs

Configurations for pre-execution setup.

cleanup_configs DemandExecutionCleanupConfigs

Configurations for post-execution cleanup.