|
5 | 5 | from typing import Annotated, Final, TypeAlias |
6 | 6 |
|
7 | 7 | import sh # type: ignore[import-untyped] |
| 8 | +from common_library.basic_types import DEFAULT_FACTORY |
8 | 9 | from models_library.docker import DockerGenericTag |
9 | 10 | from pydantic import ( |
10 | 11 | BaseModel, |
@@ -143,23 +144,32 @@ class EC2InstanceConfig: |
143 | 144 |
|
144 | 145 | class EC2InstanceBootSpecific(BaseModel): |
145 | 146 | ami_id: AMIIdStr |
146 | | - custom_boot_scripts: list[CommandStr] = Field( |
147 | | - default_factory=list, |
148 | | - description="script(s) to run on EC2 instance startup (be careful!), " |
149 | | - "each entry is run one after the other using '&&' operator", |
150 | | - ) |
151 | | - pre_pull_images: list[DockerGenericTag] = Field( |
152 | | - default_factory=list, |
153 | | - description="a list of docker image/tags to pull on instance cold start", |
154 | | - ) |
155 | | - pre_pull_images_cron_interval: datetime.timedelta = Field( |
156 | | - default=datetime.timedelta(minutes=30), |
157 | | - description="time interval between pulls of images (minimum is 1 minute) " |
158 | | - "(default to seconds, or see https://pydantic-docs.helpmanual.io/usage/types/#datetime-types for string formating)", |
159 | | - ) |
160 | | - buffer_count: NonNegativeInt = Field( |
161 | | - default=0, description="number of buffer EC2s to keep (defaults to 0)" |
162 | | - ) |
| 147 | + custom_boot_scripts: Annotated[ |
| 148 | + list[CommandStr], |
| 149 | + Field( |
| 150 | + default_factory=list, |
| 151 | + description="script(s) to run on EC2 instance startup (be careful!), " |
| 152 | + "each entry is run one after the other using '&&' operator", |
| 153 | + ), |
| 154 | + ] = DEFAULT_FACTORY |
| 155 | + pre_pull_images: Annotated[ |
| 156 | + list[DockerGenericTag], |
| 157 | + Field( |
| 158 | + default_factory=list, |
| 159 | + description="a list of docker image/tags to pull on instance cold start", |
| 160 | + ), |
| 161 | + ] = DEFAULT_FACTORY |
| 162 | + pre_pull_images_cron_interval: Annotated[ |
| 163 | + datetime.timedelta, |
| 164 | + Field( |
| 165 | + description="time interval between pulls of images (minimum is 1 minute) " |
| 166 | + "(default to seconds, or see https://pydantic-docs.helpmanual.io/usage/types/#datetime-types for string formating)", |
| 167 | + ), |
| 168 | + ] = datetime.timedelta(minutes=30) |
| 169 | + buffer_count: Annotated[ |
| 170 | + NonNegativeInt, |
| 171 | + Field(description="number of buffer EC2s to keep (defaults to 0)"), |
| 172 | + ] = 0 |
163 | 173 |
|
164 | 174 | @field_validator("custom_boot_scripts") |
165 | 175 | @classmethod |
|
0 commit comments