RuntimeOptions
Overview
TheRuntimeOptions class defines how your containerized application is executed, including the executor type, scaling, networking, and specialized execution modes.
Constructor
Parameters
The container executor/orchestrator to use for running the application.Options:
'docker', 'kubernetes'Number of replicas to run. Use for scaling your application across multiple instances.Example:
3 (runs 3 instances of the container)List of ports to expose from the container.Example:
[8080], [80, 443]Whether to expose the service publicly (create a public load balancer).Set to
True for public access. Primarily used with Kubernetes executor.Usage
Basic Runtime
Scaled Deployment
Sharded Execution
Job Execution
ShardSpec
Overview
TheShardSpec class configures sharded execution, allowing you to distribute work across multiple container instances with shard-specific data.
Constructor
Parameters
Number of shards to create. Each shard runs as a separate container instance.Example:
4 (creates 4 sharded instances)Regular expression pattern for identifying and extracting shard numbers.Example:
r'^shard-(\d+)$'Usage
JobSpec
Overview
TheJobSpec class configures job-based execution for batch processing workloads.
Constructor
Parameters
Number of times to run the job. This parameter is required when using JobSpec.Example:
10 (runs the job 10 times)Usage
Required vs Optional
RuntimeOptions:- All parameters are optional with sensible defaults
- All parameters are optional with defaults
iterationsis required