prefect.server.models.flows
¶
Functions for interacting with flow ORM objects. Intended for internal use by the Prefect REST API.
count_flows
async
¶
Count flows.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
flow_filter
|
Union[FlowFilter, None]
|
only count flows that match these filters |
None
|
flow_run_filter
|
Union[FlowRunFilter, None]
|
only count flows whose flow runs match these filters |
None
|
task_run_filter
|
Union[TaskRunFilter, None]
|
only count flows whose task runs match these filters |
None
|
deployment_filter
|
Union[DeploymentFilter, None]
|
only count flows whose deployments match these filters |
None
|
work_pool_filter
|
Union[WorkPoolFilter, None]
|
only count flows whose work pools match these filters |
None
|
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
count of flows |
Source code in prefect/server/models/flows.py
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 |
|
create_flow
async
¶
Creates a new flow.
If a flow with the same name already exists, the existing flow is returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
a database session |
required |
flow
|
Flow
|
a flow model |
required |
Returns:
Type | Description |
---|---|
ORMFlow
|
db.Flow: the newly-created or existing flow |
Source code in prefect/server/models/flows.py
25 26 27 28 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 |
|
delete_flow
async
¶
Delete a flow by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
flow_id
|
UUID
|
a flow id |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether or not the flow was deleted |
Source code in prefect/server/models/flows.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
read_flow
async
¶
Reads a flow by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
flow_id
|
UUID
|
a flow id |
required |
Returns:
Type | Description |
---|---|
Optional[ORMFlow]
|
db.Flow: the flow |
Source code in prefect/server/models/flows.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
read_flow_by_name
async
¶
Reads a flow by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
name
|
str
|
a flow name |
required |
Returns:
Type | Description |
---|---|
Optional[ORMFlow]
|
db.Flow: the flow |
Source code in prefect/server/models/flows.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
read_flows
async
¶
Read multiple flows.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
flow_filter
|
Union[FlowFilter, None]
|
only select flows that match these filters |
None
|
flow_run_filter
|
Union[FlowRunFilter, None]
|
only select flows whose flow runs match these filters |
None
|
task_run_filter
|
Union[TaskRunFilter, None]
|
only select flows whose task runs match these filters |
None
|
deployment_filter
|
Union[DeploymentFilter, None]
|
only select flows whose deployments match these filters |
None
|
work_pool_filter
|
Union[WorkPoolFilter, None]
|
only select flows whose work pools match these filters |
None
|
offset
|
Union[int, None]
|
Query offset |
None
|
limit
|
Union[int, None]
|
Query limit |
None
|
Returns:
Type | Description |
---|---|
Sequence[ORMFlow]
|
List[db.Flow]: flows |
Source code in prefect/server/models/flows.py
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 |
|
update_flow
async
¶
Updates a flow.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
a database session |
required |
flow_id
|
UUID
|
the flow id to update |
required |
flow
|
FlowUpdate
|
a flow update model |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether or not matching rows were found to update |
Source code in prefect/server/models/flows.py
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 |
|