prefect.server.models.task_runs
¶
Functions for interacting with task run ORM objects. Intended for internal use by the Prefect REST API.
count_task_runs
async
¶
Count task runs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
a database session |
required |
flow_filter |
FlowFilter
|
only count task runs whose flows match these filters |
None
|
flow_run_filter |
FlowRunFilter
|
only count task runs whose flow runs match these filters |
None
|
task_run_filter |
TaskRunFilter
|
only count task runs that match these filters |
None
|
deployment_filter |
DeploymentFilter
|
only count task runs whose deployments match these filters |
None
|
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
|
create_task_run
async
¶
Creates a new task run.
If a task run with the same flow_run_id, task_key, and dynamic_key already exists, the existing task run will be returned. If the provided task run has a state attached, it will also be created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
a database session |
required |
task_run |
TaskRun
|
a task run model |
required |
Returns:
Type | Description |
---|---|
db.TaskRun: the newly-created or existing task run |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
29 30 31 32 33 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 |
|
delete_task_run
async
¶
Delete a task run by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
a database session |
required |
task_run_id |
UUID
|
the task run id to delete |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether or not the task run was deleted |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
read_task_run
async
¶
Read a task run by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
a database session |
required |
task_run_id |
UUID
|
the task run id |
required |
Returns:
Type | Description |
---|---|
db.TaskRun: the task run |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
read_task_runs
async
¶
Read task runs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
a database session |
required |
flow_filter |
FlowFilter
|
only select task runs whose flows match these filters |
None
|
flow_run_filter |
FlowRunFilter
|
only select task runs whose flow runs match these filters |
None
|
task_run_filter |
TaskRunFilter
|
only select task runs that match these filters |
None
|
deployment_filter |
DeploymentFilter
|
only select task runs whose deployments match these filters |
None
|
offset |
int
|
Query offset |
None
|
limit |
int
|
Query limit |
None
|
sort |
TaskRunSort
|
Query sort |
ID_DESC
|
Returns:
Type | Description |
---|---|
List[db.TaskRun]: the task runs |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
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 |
|
set_task_run_state
async
¶
Creates a new orchestrated task run state.
Setting a new state on a run is the one of the principal actions that is governed by
Prefect's orchestration logic. Setting a new run state will not guarantee creation,
but instead trigger orchestration rules to govern the proposed state
input. If
the state is considered valid, it will be written to the database. Otherwise, a
it's possible a different state, or no state, will be created. A force
flag is
supplied to bypass a subset of orchestration logic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
a database session |
required |
task_run_id |
UUID
|
the task run id |
required |
state |
State
|
a task run state model |
required |
force |
bool
|
if False, orchestration rules will be applied that may alter or prevent the state transition. If True, orchestration rules are not applied. |
False
|
Returns:
Type | Description |
---|---|
OrchestrationResult
|
OrchestrationResult object |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
update_task_run
async
¶
Updates a task run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
a database session |
required |
task_run_id |
UUID
|
the task run id to update |
required |
task_run |
TaskRunUpdate
|
a task run model |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether or not matching rows were found to update |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/server/models/task_runs.py
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 |
|