Deployment configuration objects
These configuration objects can be used to configure deployments.
For example:
from swerex.deployment.config import DockerDeploymentConfig
config = DockerDeploymentConfig(image="python:3.11")
deployment = config.get_deployment()
DeploymentConfig
module-attribute
DeploymentConfig = LocalDeploymentConfig | DockerDeploymentConfig | ModalDeploymentConfig | FargateDeploymentConfig | RemoteDeploymentConfig | DummyDeploymentConfig
Union of all deployment configurations. Useful for type hints.
LocalDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running locally.
Config:
extra
:'forbid'
Fields:
-
type
(Literal['local']
)
type
pydantic-field
type: Literal['local'] = 'local'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
DockerDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running locally in a Docker container.
Config:
extra
:'forbid'
Fields:
-
image
(str
) -
port
(int | None
) -
docker_args
(list[str]
) -
startup_timeout
(float
) -
pull
(Literal['never', 'always', 'missing']
) -
remove_images
(bool
) -
type
(Literal['docker']
)
image
pydantic-field
image: str = 'python:3.11'
The name of the docker image to use.
port
pydantic-field
port: int | None = None
The port that the docker container connects to. If None, a free port is found.
docker_args
pydantic-field
docker_args: list[str] = []
Additional arguments to pass to the docker run command.
startup_timeout
pydantic-field
startup_timeout: float = 180.0
The time to wait for the runtime to start.
pull
pydantic-field
pull: Literal['never', 'always', 'missing'] = 'missing'
When to pull docker images.
remove_images
pydantic-field
remove_images: bool = False
Whether to remove the image after it has stopped.
type
pydantic-field
type: Literal['docker'] = 'docker'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
ModalDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running on Modal.
Config:
extra
:'forbid'
Fields:
-
image
(str | PurePath
) -
startup_timeout
(float
) -
runtime_timeout
(float
) -
deployment_timeout
(float
) -
modal_sandbox_kwargs
(dict[str, Any]
) -
type
(Literal['modal']
) -
install_pipx
(bool
)
image
pydantic-field
image: str | PurePath = 'python:3.11'
Image to use for the deployment.
startup_timeout
pydantic-field
startup_timeout: float = 180.0
The time to wait for the runtime to start.
runtime_timeout
pydantic-field
runtime_timeout: float = 60.0
Runtime timeout (default timeout for all runtime requests)
deployment_timeout
pydantic-field
deployment_timeout: float = 1800.0
Kill deployment after this many seconds no matter what. This is a useful killing switch to ensure that you don't spend too much money on modal.
modal_sandbox_kwargs
pydantic-field
modal_sandbox_kwargs: dict[str, Any] = {}
Additional arguments to pass to modal.Sandbox.create
type
pydantic-field
type: Literal['modal'] = 'modal'
Discriminator for (de)serialization/CLI. Do not change.
install_pipx
pydantic-field
install_pipx: bool = True
Whether to install pipx with apt in the container. This is enabled by default so we can fall back to installing swe-rex with pipx if the image does not have it. However, depending on your image, installing pipx might fail (or be slow).
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
FargateDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for running on AWS Fargate.
Config:
extra
:'forbid'
Fields:
-
image
(str
) -
port
(int
) -
cluster_name
(str
) -
execution_role_prefix
(str
) -
task_definition_prefix
(str
) -
log_group
(str | None
) -
security_group_prefix
(str
) -
fargate_args
(dict[str, str]
) -
container_timeout
(float
) -
runtime_timeout
(float
) -
type
(Literal['fargate']
)
image
pydantic-field
image: str = 'python:3.11'
port
pydantic-field
port: int = 8880
cluster_name
pydantic-field
cluster_name: str = 'swe-rex-cluster'
execution_role_prefix
pydantic-field
execution_role_prefix: str = 'swe-rex-execution-role'
task_definition_prefix
pydantic-field
task_definition_prefix: str = 'swe-rex-task'
log_group
pydantic-field
log_group: str | None = '/ecs/swe-rex-deployment'
security_group_prefix
pydantic-field
security_group_prefix: str = 'swe-rex-deployment-sg'
fargate_args
pydantic-field
fargate_args: dict[str, str] = {}
container_timeout
pydantic-field
container_timeout: float = 60 * 15
runtime_timeout
pydantic-field
runtime_timeout: float = 30
type
pydantic-field
type: Literal['fargate'] = 'fargate'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
RemoteDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for RemoteDeployment
, a wrapper around RemoteRuntime
that can be used to connect to any
swerex server.
Config:
extra
:'forbid'
Fields:
-
auth_token
(str
) -
host
(str
) -
port
(int | None
) -
timeout
(float
) -
type
(Literal['remote']
)
auth_token
pydantic-field
auth_token: str
The token to use for authentication.
host
pydantic-field
host: str = 'http://127.0.0.1'
The host to connect to.
port
pydantic-field
port: int | None = None
The port to connect to.
timeout
pydantic-field
timeout: float = 0.15
type
pydantic-field
type: Literal['remote'] = 'remote'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')
DummyDeploymentConfig
pydantic-model
Bases: BaseModel
Configuration for DummyDeployment
, a deployment that is used for testing.
Config:
extra
:'forbid'
Fields:
-
type
(Literal['dummy']
)
type
pydantic-field
type: Literal['dummy'] = 'dummy'
Discriminator for (de)serialization/CLI. Do not change.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(extra='forbid')