prefect.server.models.flow_runs
¶
Functions for interacting with flow run ORM objects. Intended for internal use by the Prefect REST API.
count_flow_runs
async
¶
Count flow runs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
a database session |
required |
flow_filter |
FlowFilter
|
only count flow runs whose flows match these filters |
None
|
flow_run_filter |
FlowRunFilter
|
only count flow runs that match these filters |
None
|
task_run_filter |
TaskRunFilter
|
only count flow runs whose task runs match these filters |
None
|
deployment_filter |
DeploymentFilter
|
only count flow runs whose deployments match these filters |
None
|
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
count of flow runs |
Source code in prefect/server/models/flow_runs.py
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 405 406 407 408 409 410 411 412 413 |
|
create_flow_run
async
¶
Creates a new flow run.
If the provided flow run has a state attached, it will also be created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
a database session |
required |
flow_run |
FlowRun
|
a flow run model |
required |
Returns:
Type | Description |
---|---|
ORMFlowRun
|
db.FlowRun: the newly-created flow run |
Source code in prefect/server/models/flow_runs.py
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 |
|
delete_flow_run
async
¶
Delete a flow run by flow_run_id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
A database session |
required |
flow_run_id |
UUID
|
a flow run id |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether or not the flow run was deleted |
Source code in prefect/server/models/flow_runs.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
|
read_flow_run
async
¶
Reads a flow run by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
A database session |
required |
flow_run_id |
UUID
|
a flow run id |
required |
Returns:
Type | Description |
---|---|
Optional[ORMFlowRun]
|
db.FlowRun: the flow run |
Source code in prefect/server/models/flow_runs.py
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 |
|
read_flow_run_graph
async
¶
Given a flow run, return the graph of it's task and subflow runs. If a since
datetime is provided, only return items that may have changed since that time.
Source code in prefect/server/models/flow_runs.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
|
read_flow_runs
async
¶
Read flow runs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
a database session |
required |
columns |
List
|
a list of the flow run ORM columns to load, for performance |
None
|
flow_filter |
FlowFilter
|
only select flow runs whose flows match these filters |
None
|
flow_run_filter |
FlowRunFilter
|
only select flow runs match these filters |
None
|
task_run_filter |
TaskRunFilter
|
only select flow runs whose task runs match these filters |
None
|
deployment_filter |
DeploymentFilter
|
only select flow runs whose deployments match these filters |
None
|
offset |
int
|
Query offset |
None
|
limit |
int
|
Query limit |
None
|
sort |
FlowRunSort
|
Query sort |
ID_DESC
|
Returns:
Type | Description |
---|---|
Sequence[ORMFlowRun]
|
List[db.FlowRun]: flow runs |
Source code in prefect/server/models/flow_runs.py
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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
read_task_run_dependencies
async
¶
Get a task run dependency map for a given flow run.
Source code in prefect/server/models/flow_runs.py
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 |
|
set_flow_run_state
async
¶
Creates a new orchestrated flow 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 |
AsyncSession
|
a database session |
required |
flow_run_id |
UUID
|
the flow run id |
required |
state |
State
|
a flow 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 prefect/server/models/flow_runs.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
|
update_flow_run
async
¶
Updates a flow run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
a database session |
required |
flow_run_id |
UUID
|
the flow run id to update |
required |
flow_run |
FlowRunUpdate
|
a flow run model |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether or not matching rows were found to update |
Source code in prefect/server/models/flow_runs.py
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 |
|