Skip to content

Commit

Permalink
Implement labels field on Flow, Deployment, FlowRun, and TaskRun (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bunchesofdonald authored Nov 22, 2024
1 parent 917a2d2 commit 9490d6c
Show file tree
Hide file tree
Showing 25 changed files with 727 additions and 36 deletions.
292 changes: 292 additions & 0 deletions docs/v3/api-ref/rest-api/server/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15242,6 +15242,40 @@
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"pull_steps": {
"anyOf": [
{
Expand Down Expand Up @@ -15981,6 +16015,33 @@
]
]
},
"labels": {
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object",
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"work_queue_name": {
"anyOf": [
{
Expand Down Expand Up @@ -17184,6 +17245,40 @@
"tag-2"
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
}
},
"type": "object",
Expand Down Expand Up @@ -17217,6 +17312,40 @@
"tag-2"
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -17616,6 +17745,40 @@
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"parent_task_run_id": {
"anyOf": [
{
Expand Down Expand Up @@ -17904,6 +18067,40 @@
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"idempotency_key": {
"anyOf": [
{
Expand Down Expand Up @@ -19360,6 +19557,33 @@
]
]
},
"labels": {
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object",
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"parent_task_run_id": {
"anyOf": [
{
Expand Down Expand Up @@ -21967,6 +22191,40 @@
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"state_id": {
"anyOf": [
{
Expand Down Expand Up @@ -22239,6 +22497,40 @@
]
]
},
"labels": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "string"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Labels",
"description": "A dictionary of key-value labels. Values can be strings, numbers, or booleans.",
"examples": [
{
"key": "value1",
"key2": 42
}
]
},
"task_inputs": {
"additionalProperties": {
"items": {
Expand Down
5 changes: 5 additions & 0 deletions src/prefect/client/schemas/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from prefect.settings import PREFECT_DEPLOYMENT_SCHEDULE_MAX_SCHEDULED_RUNS
from prefect.types import (
MAX_VARIABLE_NAME_LENGTH,
KeyValueLabelsField,
Name,
NonEmptyishName,
NonNegativeFloat,
Expand Down Expand Up @@ -66,6 +67,7 @@ class FlowCreate(ActionBaseModel):
description="A list of flow tags",
examples=[["tag-1", "tag-2"]],
)
labels: KeyValueLabelsField


class FlowUpdate(ActionBaseModel):
Expand Down Expand Up @@ -159,6 +161,7 @@ def convert_to_strings(cls, values):
description="Parameters for flow runs scheduled by the deployment.",
)
tags: List[str] = Field(default_factory=list)
labels: KeyValueLabelsField
pull_steps: Optional[List[dict]] = Field(None)

work_queue_name: Optional[str] = Field(None)
Expand Down Expand Up @@ -315,6 +318,7 @@ class TaskRunCreate(ActionBaseModel):
default_factory=objects.TaskRunPolicy,
)
tags: List[str] = Field(default_factory=list)
labels: KeyValueLabelsField
task_inputs: Dict[
str,
List[
Expand Down Expand Up @@ -357,6 +361,7 @@ class FlowRunCreate(ActionBaseModel):
default_factory=objects.FlowRunPolicy
)
tags: List[str] = Field(default_factory=list)
labels: KeyValueLabelsField
idempotency_key: Optional[str] = Field(None)


Expand Down
Loading

0 comments on commit 9490d6c

Please sign in to comment.