SmartJob and ExecutionConfig objects
At your user level, you have to manipulate two classes:
- smartjob.SmartJob to define jobs
- smartjob.ExecutionConfig to define "execution config" for running your jobs
Depending on the options you want to set, you can also use the following classes:
- smartjob.RetryConfig to define "retries" in
ExecutionConfig - smartjob.TimeoutConfig to define "timeouts" in
ExecutionConfig
SmartJob class
smartjob.SmartJob
dataclass
Base class for smart jobs.
Source code in smartjob/app/job.py
add_envs: dict[str, str] = field(default_factory=dict)
class-attribute
instance-attribute
Environnement variables to add in the container.
Note: INPUT_PATH and OUTPUT_PATH will be automatically injected (if relevant).
docker_image: str
instance-attribute
Docker image to use for the job.
Example: docker.io/python:3.12.
full_name: str
property
Return the full name of the job (namespace + name).
name: str
instance-attribute
Name of the job.
namespace: str = DEFAULT_NAMESPACE
class-attribute
instance-attribute
Namespace of the job.
overridden_args: list[str] = field(default_factory=list)
class-attribute
instance-attribute
Container arguments (including command) to use.
Notes
- if not set, the default container image arguments will be used.
- the placeholder {{INPUT}} will be automatically replaced by the local full path of the input directory.
python_script_path: str = ''
class-attribute
instance-attribute
Local path to a python script to execute in the container.
Note: if set, it will override overridden_args.
ExecutionConfig class
smartjob.ExecutionConfig
dataclass
ExecutionConfig is the configuration for a job execution.
Source code in smartjob/app/execution.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
accelerator_count: int | None = None
class-attribute
instance-attribute
Number of accelerators (only for vertex executor).
accelerator_type: str | None = None
class-attribute
instance-attribute
Accelerator type (only for vertex executor).
boot_disk_size_gb: int | None = None
class-attribute
instance-attribute
Boot disk size in Gb (only for vertex executor).
boot_disk_type: str | None = None
class-attribute
instance-attribute
Boot disk type (only for vertex executor).
cpu: float | None = None
class-attribute
instance-attribute
Number of requested CPUs (only for cloudrun executor).
install_ops_agent: bool | None = None
class-attribute
instance-attribute
Install ops agent (only for cloudbatch executor).
labels: dict[str, str] | None = None
class-attribute
instance-attribute
GCP labels (only for cloudrun/cloudbatch/vertex executor).
machine_type: str | None = None
class-attribute
instance-attribute
Machine type (only for vertex executor).
memory_gb: float | None = None
class-attribute
instance-attribute
Memory in Gb (only for cloudrun executor).
project: str | None = None
class-attribute
instance-attribute
GCP project (only for cloudrun/cloudbatch/vertex executor).
region: str | None = None
class-attribute
instance-attribute
GCP region (only for cloudrun/cloudbatch/vertex executor).
retry_config: RetryConfig | None = None
class-attribute
instance-attribute
Retry configuration.
service_account: str | None = None
class-attribute
instance-attribute
Service account (email) to use for the job execution (only for cloudrun/cloudbatch/vertex executor).
sidecars_container_images: list[str] | None = None
class-attribute
instance-attribute
List of container images for sidecars.
staging_bucket: str | None = None
class-attribute
instance-attribute
Staging bucket (for input, output and/or loading python_script_path, only for cloudrun/cloudbatch/vertex executor).
timeout_config: TimeoutConfig | None = None
class-attribute
instance-attribute
Timeout configuration.
vpc_connector_network: str | None = None
class-attribute
instance-attribute
VPC connector network (only for cloudrun/cloudbatch executor).
vpc_connector_subnetwork: str | None = None
class-attribute
instance-attribute
VPC connector subnetwork (only for cloudrun/cloudbatch executor).
Dedicated class for defining "retries" in ExecutionConfig
smartjob.RetryConfig
dataclass
Retry configuration.
Source code in smartjob/app/retry.py
max_attempts: int = 1
class-attribute
instance-attribute
FIXME
max_attempts_download: int | None = None
class-attribute
instance-attribute
FIXME
max_attempts_execute: int | None = None
class-attribute
instance-attribute
FIXME
max_attempts_schedule: int | None = None
class-attribute
instance-attribute
FIXME
Dedicated class for defining "timeouts" in ExecutionConfig
smartjob.TimeoutConfig
dataclass
Timeout configuration.
Source code in smartjob/app/timeout.py
timeout_seconds: int = 3600
class-attribute
instance-attribute
FIXME
timeout_seconds_download: int | None = None
class-attribute
instance-attribute
FIXME
timeout_seconds_schedule: int | None = None
class-attribute
instance-attribute
FIXME