prefect-client 3.3.2.dev2__py3-none-any.whl → 3.3.3.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prefect/_build_info.py +3 -3
- prefect/client/orchestration/__init__.py +5 -0
- prefect/client/orchestration/_deployments/client.py +51 -16
- prefect/client/schemas/actions.py +20 -1
- prefect/context.py +2 -1
- prefect/server/api/ui/task_runs.py +21 -1
- {prefect_client-3.3.2.dev2.dist-info → prefect_client-3.3.3.dev1.dist-info}/METADATA +1 -1
- {prefect_client-3.3.2.dev2.dist-info → prefect_client-3.3.3.dev1.dist-info}/RECORD +10 -10
- {prefect_client-3.3.2.dev2.dist-info → prefect_client-3.3.3.dev1.dist-info}/WHEEL +0 -0
- {prefect_client-3.3.2.dev2.dist-info → prefect_client-3.3.3.dev1.dist-info}/licenses/LICENSE +0 -0
prefect/_build_info.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Generated by versioningit
|
2
|
-
__version__ = "3.3.
|
3
|
-
__build_date__ = "2025-04-
|
4
|
-
__git_commit__ = "
|
2
|
+
__version__ = "3.3.3.dev1"
|
3
|
+
__build_date__ = "2025-04-04 08:08:08.629815+00:00"
|
4
|
+
__git_commit__ = "cf8d1ca6f0eb2e922c48162b40454fd5b1cfb192"
|
5
5
|
__dirty__ = False
|
@@ -1,3 +1,4 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import asyncio
|
2
3
|
import base64
|
3
4
|
import datetime
|
@@ -1164,6 +1165,10 @@ class PrefectClient(
|
|
1164
1165
|
def client_version(self) -> str:
|
1165
1166
|
return prefect.__version__
|
1166
1167
|
|
1168
|
+
@property
|
1169
|
+
def loop(self) -> asyncio.AbstractEventLoop | None:
|
1170
|
+
return self._loop
|
1171
|
+
|
1167
1172
|
async def raise_for_api_version_mismatch(self) -> None:
|
1168
1173
|
# Cloud is always compatible as a server
|
1169
1174
|
if self.server_type == ServerType.CLOUD:
|
@@ -29,6 +29,7 @@ if TYPE_CHECKING:
|
|
29
29
|
from prefect.client.schemas.objects import (
|
30
30
|
ConcurrencyOptions,
|
31
31
|
DeploymentSchedule,
|
32
|
+
VersionInfo,
|
32
33
|
)
|
33
34
|
from prefect.client.schemas.responses import (
|
34
35
|
DeploymentResponse,
|
@@ -48,6 +49,7 @@ class DeploymentClient(BaseClient):
|
|
48
49
|
flow_id: "UUID",
|
49
50
|
name: str,
|
50
51
|
version: str | None = None,
|
52
|
+
version_info: "VersionInfo | None" = None,
|
51
53
|
schedules: list["DeploymentScheduleCreate"] | None = None,
|
52
54
|
concurrency_limit: int | None = None,
|
53
55
|
concurrency_options: "ConcurrencyOptions | None" = None,
|
@@ -65,6 +67,9 @@ class DeploymentClient(BaseClient):
|
|
65
67
|
pull_steps: list[dict[str, Any]] | None = None,
|
66
68
|
enforce_parameter_schema: bool | None = None,
|
67
69
|
job_variables: dict[str, Any] | None = None,
|
70
|
+
branch: str | None = None,
|
71
|
+
base: UUID | None = None,
|
72
|
+
root: UUID | None = None,
|
68
73
|
) -> "UUID":
|
69
74
|
"""
|
70
75
|
Create a deployment.
|
@@ -99,6 +104,7 @@ class DeploymentClient(BaseClient):
|
|
99
104
|
flow_id=flow_id,
|
100
105
|
name=name,
|
101
106
|
version=version,
|
107
|
+
version_info=version_info,
|
102
108
|
parameters=dict(parameters or {}),
|
103
109
|
tags=list(tags or []),
|
104
110
|
work_queue_name=work_queue_name,
|
@@ -115,6 +121,9 @@ class DeploymentClient(BaseClient):
|
|
115
121
|
concurrency_options=concurrency_options,
|
116
122
|
pull_steps=pull_steps,
|
117
123
|
enforce_parameter_schema=enforce_parameter_schema,
|
124
|
+
branch=branch,
|
125
|
+
base=base,
|
126
|
+
root=root,
|
118
127
|
)
|
119
128
|
|
120
129
|
if work_pool_name is not None:
|
@@ -123,20 +132,29 @@ class DeploymentClient(BaseClient):
|
|
123
132
|
# Exclude newer fields that are not set to avoid compatibility issues
|
124
133
|
exclude = {
|
125
134
|
field
|
126
|
-
for field in [
|
135
|
+
for field in [
|
136
|
+
"work_pool_name",
|
137
|
+
"work_queue_name",
|
138
|
+
]
|
127
139
|
if field not in deployment_create.model_fields_set
|
128
140
|
}
|
129
141
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
142
|
+
exclude_if_none = [
|
143
|
+
"paused",
|
144
|
+
"pull_steps",
|
145
|
+
"enforce_parameter_schema",
|
146
|
+
"version_info",
|
147
|
+
"branch",
|
148
|
+
"base",
|
149
|
+
"root",
|
150
|
+
]
|
135
151
|
|
136
|
-
|
137
|
-
|
152
|
+
for field in exclude_if_none:
|
153
|
+
if getattr(deployment_create, field) is None:
|
154
|
+
exclude.add(field)
|
138
155
|
|
139
156
|
json = deployment_create.model_dump(mode="json", exclude=exclude)
|
157
|
+
|
140
158
|
response = self.request(
|
141
159
|
"POST",
|
142
160
|
"/deployments/",
|
@@ -593,6 +611,7 @@ class DeploymentAsyncClient(BaseAsyncClient):
|
|
593
611
|
flow_id: "UUID",
|
594
612
|
name: str,
|
595
613
|
version: str | None = None,
|
614
|
+
version_info: "VersionInfo | None" = None,
|
596
615
|
schedules: list["DeploymentScheduleCreate"] | None = None,
|
597
616
|
concurrency_limit: int | None = None,
|
598
617
|
concurrency_options: "ConcurrencyOptions | None" = None,
|
@@ -610,6 +629,9 @@ class DeploymentAsyncClient(BaseAsyncClient):
|
|
610
629
|
pull_steps: list[dict[str, Any]] | None = None,
|
611
630
|
enforce_parameter_schema: bool | None = None,
|
612
631
|
job_variables: dict[str, Any] | None = None,
|
632
|
+
branch: str | None = None,
|
633
|
+
base: UUID | None = None,
|
634
|
+
root: UUID | None = None,
|
613
635
|
) -> "UUID":
|
614
636
|
"""
|
615
637
|
Create a deployment.
|
@@ -644,6 +666,7 @@ class DeploymentAsyncClient(BaseAsyncClient):
|
|
644
666
|
flow_id=flow_id,
|
645
667
|
name=name,
|
646
668
|
version=version,
|
669
|
+
version_info=version_info,
|
647
670
|
parameters=dict(parameters or {}),
|
648
671
|
tags=list(tags or []),
|
649
672
|
work_queue_name=work_queue_name,
|
@@ -660,6 +683,9 @@ class DeploymentAsyncClient(BaseAsyncClient):
|
|
660
683
|
concurrency_options=concurrency_options,
|
661
684
|
pull_steps=pull_steps,
|
662
685
|
enforce_parameter_schema=enforce_parameter_schema,
|
686
|
+
branch=branch,
|
687
|
+
base=base,
|
688
|
+
root=root,
|
663
689
|
)
|
664
690
|
|
665
691
|
if work_pool_name is not None:
|
@@ -668,20 +694,29 @@ class DeploymentAsyncClient(BaseAsyncClient):
|
|
668
694
|
# Exclude newer fields that are not set to avoid compatibility issues
|
669
695
|
exclude = {
|
670
696
|
field
|
671
|
-
for field in [
|
697
|
+
for field in [
|
698
|
+
"work_pool_name",
|
699
|
+
"work_queue_name",
|
700
|
+
]
|
672
701
|
if field not in deployment_create.model_fields_set
|
673
702
|
}
|
674
703
|
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
704
|
+
exclude_if_none = [
|
705
|
+
"paused",
|
706
|
+
"pull_steps",
|
707
|
+
"enforce_parameter_schema",
|
708
|
+
"version_info",
|
709
|
+
"branch",
|
710
|
+
"base",
|
711
|
+
"root",
|
712
|
+
]
|
680
713
|
|
681
|
-
|
682
|
-
|
714
|
+
for field in exclude_if_none:
|
715
|
+
if getattr(deployment_create, field) is None:
|
716
|
+
exclude.add(field)
|
683
717
|
|
684
718
|
json = deployment_create.model_dump(mode="json", exclude=exclude)
|
719
|
+
|
685
720
|
response = await self.request(
|
686
721
|
"POST",
|
687
722
|
"/deployments/",
|
@@ -253,13 +253,29 @@ class DeploymentCreate(ActionBaseModel):
|
|
253
253
|
infrastructure_document_id: Optional[UUID] = Field(default=None)
|
254
254
|
description: Optional[str] = Field(default=None)
|
255
255
|
path: Optional[str] = Field(default=None)
|
256
|
-
version: Optional[str] = Field(default=None)
|
257
256
|
entrypoint: Optional[str] = Field(default=None)
|
258
257
|
job_variables: dict[str, Any] = Field(
|
259
258
|
default_factory=dict,
|
260
259
|
description="Overrides to apply to flow run infrastructure at runtime.",
|
261
260
|
)
|
262
261
|
|
262
|
+
# Versionining
|
263
|
+
version: Optional[str] = Field(default=None)
|
264
|
+
version_info: Optional[objects.VersionInfo] = Field(
|
265
|
+
default=None, description="Version information for the deployment."
|
266
|
+
)
|
267
|
+
|
268
|
+
# Branching
|
269
|
+
branch: Optional[str] = Field(
|
270
|
+
default=None, description="The branch of the deployment."
|
271
|
+
)
|
272
|
+
base: Optional[UUID] = Field(
|
273
|
+
default=None, description="The base deployment of the deployment."
|
274
|
+
)
|
275
|
+
root: Optional[UUID] = Field(
|
276
|
+
default=None, description="The root deployment of the deployment."
|
277
|
+
)
|
278
|
+
|
263
279
|
def check_valid_configuration(self, base_job_template: dict[str, Any]) -> None:
|
264
280
|
"""Check that the combination of base_job_template defaults
|
265
281
|
and job_variables conforms to the specified schema.
|
@@ -289,6 +305,9 @@ class DeploymentUpdate(ActionBaseModel):
|
|
289
305
|
return remove_old_deployment_fields(values)
|
290
306
|
|
291
307
|
version: Optional[str] = Field(default=None)
|
308
|
+
version_info: Optional[objects.VersionInfo] = Field(
|
309
|
+
default=None, description="Version information for the deployment."
|
310
|
+
)
|
292
311
|
description: Optional[str] = Field(default=None)
|
293
312
|
parameters: Optional[dict[str, Any]] = Field(
|
294
313
|
default=None,
|
prefect/context.py
CHANGED
@@ -6,6 +6,7 @@ These contexts should never be directly mutated by the user.
|
|
6
6
|
For more user-accessible information about the current run, see [`prefect.runtime`](../runtime/flow_run).
|
7
7
|
"""
|
8
8
|
|
9
|
+
import asyncio
|
9
10
|
import os
|
10
11
|
import sys
|
11
12
|
import warnings
|
@@ -294,7 +295,7 @@ class AsyncClientContext(ContextModel):
|
|
294
295
|
@asynccontextmanager
|
295
296
|
async def get_or_create(cls) -> AsyncGenerator[Self, None]:
|
296
297
|
ctx = cls.get()
|
297
|
-
if ctx:
|
298
|
+
if ctx and asyncio.get_running_loop() is ctx.client.loop:
|
298
299
|
yield ctx
|
299
300
|
else:
|
300
301
|
async with cls() as ctx:
|
@@ -1,8 +1,9 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from typing import TYPE_CHECKING, List, Optional
|
3
|
+
from uuid import UUID
|
3
4
|
|
4
5
|
import sqlalchemy as sa
|
5
|
-
from fastapi import Depends, HTTPException, status
|
6
|
+
from fastapi import Depends, HTTPException, Path, status
|
6
7
|
from pydantic import Field, model_serializer
|
7
8
|
|
8
9
|
import prefect.server.schemas as schemas
|
@@ -173,3 +174,22 @@ async def read_task_run_counts_by_state(
|
|
173
174
|
task_run_filter=task_runs,
|
174
175
|
deployment_filter=deployments,
|
175
176
|
)
|
177
|
+
|
178
|
+
|
179
|
+
@router.get("/{id}")
|
180
|
+
async def read_task_run_with_flow_run_name(
|
181
|
+
task_run_id: UUID = Path(..., description="The task run id", alias="id"),
|
182
|
+
db: PrefectDBInterface = Depends(provide_database_interface),
|
183
|
+
) -> schemas.ui.UITaskRun:
|
184
|
+
"""
|
185
|
+
Get a task run by id.
|
186
|
+
"""
|
187
|
+
async with db.session_context() as session:
|
188
|
+
task_run = await models.task_runs.read_task_run_with_flow_run_name(
|
189
|
+
session=session, task_run_id=task_run_id
|
190
|
+
)
|
191
|
+
|
192
|
+
if not task_run:
|
193
|
+
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Task not found")
|
194
|
+
|
195
|
+
return schemas.ui.UITaskRun.model_validate(task_run)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
|
2
2
|
prefect/__init__.py,sha256=iCdcC5ZmeewikCdnPEP6YBAjPNV5dvfxpYCTpw30Hkw,3685
|
3
3
|
prefect/__main__.py,sha256=WFjw3kaYJY6pOTA7WDOgqjsz8zUEUZHCcj3P5wyVa-g,66
|
4
|
-
prefect/_build_info.py,sha256=
|
4
|
+
prefect/_build_info.py,sha256=1v_7G1GtnkkZe_J8uxG6qsaa1fWnVzFj2SR5ASzo6Mg,185
|
5
5
|
prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
|
6
6
|
prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
|
7
7
|
prefect/agent.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
|
8
8
|
prefect/artifacts.py,sha256=dMBUOAWnUamzjb5HSqwB5-GR2Qb-Gxee26XG5NDCUuw,22720
|
9
9
|
prefect/automations.py,sha256=ZzPxn2tINdlXTQo805V4rIlbXuNWxd7cdb3gTJxZIeY,12567
|
10
10
|
prefect/cache_policies.py,sha256=Kwdei4JjitNfx42OepKpDNxwPtEwRgUUAn_soxsnNzI,12699
|
11
|
-
prefect/context.py,sha256=
|
11
|
+
prefect/context.py,sha256=LYEOlz7ZkuSDj7TmrE4mByy3N3TquFkIE2hEy0WHW1Y,23798
|
12
12
|
prefect/engine.py,sha256=uB5JN4l045i5JTlRQNT1x7MwlSiGQ5Bop2Q6jHHOgxY,3699
|
13
13
|
prefect/exceptions.py,sha256=wZLQQMRB_DyiYkeEdIC5OKwbba5A94Dlnics-lrWI7A,11581
|
14
14
|
prefect/filesystems.py,sha256=v5YqGB4uXf9Ew2VuB9VCSkawvYMMVvEtZf7w1VmAmr8,18036
|
@@ -82,7 +82,7 @@ prefect/client/collections.py,sha256=t9XkVU_onQMZ871L21F1oZnAiPSQeeVfd_MuDEBS3iM
|
|
82
82
|
prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
|
83
83
|
prefect/client/subscriptions.py,sha256=b2gjoWjrTjshnv_s6zlPN3t0JIe2EKAdMqEzj3-kc6w,3879
|
84
84
|
prefect/client/utilities.py,sha256=UEJD6nwYg2mD8-GSmru-E2ofXaBlmSFZ2-8T_5rIK6c,3472
|
85
|
-
prefect/client/orchestration/__init__.py,sha256=
|
85
|
+
prefect/client/orchestration/__init__.py,sha256=1GHRA9-JWPBX6oSVNytQ1qL6epFeslRT2oBgZdFDJ68,60807
|
86
86
|
prefect/client/orchestration/base.py,sha256=HM6ryHBZSzuHoCFQM9u5qR5k1dN9Bbr_ah6z1UPNbZQ,1542
|
87
87
|
prefect/client/orchestration/routes.py,sha256=JFG1OWUBfrxPKW8Q7XWItlhOrSZ67IOySSoFZ6mxzm0,4364
|
88
88
|
prefect/client/orchestration/_artifacts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -98,7 +98,7 @@ prefect/client/orchestration/_blocks_types/client.py,sha256=alA4xD-yp3mycAbzMyRu
|
|
98
98
|
prefect/client/orchestration/_concurrency_limits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
99
99
|
prefect/client/orchestration/_concurrency_limits/client.py,sha256=r_oyY7hQbgyG1rntwe7WWcsraQHBKhk6MOPFUAHWiVc,23678
|
100
100
|
prefect/client/orchestration/_deployments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
101
|
-
prefect/client/orchestration/_deployments/client.py,sha256=
|
101
|
+
prefect/client/orchestration/_deployments/client.py,sha256=GmKUbUB0gdFoPzp7zZVf1kQilErzhW09ivZPZ05-Zew,41548
|
102
102
|
prefect/client/orchestration/_flow_runs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
103
103
|
prefect/client/orchestration/_flow_runs/client.py,sha256=fjh5J-LG8tsny7BGYEvynbuGuHDAudYHpx-PamL0GYQ,32220
|
104
104
|
prefect/client/orchestration/_flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -110,7 +110,7 @@ prefect/client/orchestration/_variables/client.py,sha256=wKBbZBLGgs5feDCil-xxKt3
|
|
110
110
|
prefect/client/orchestration/_work_pools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
111
111
|
prefect/client/orchestration/_work_pools/client.py,sha256=s1DfUQQBgB2sLiVVPhLNTlkueUDE6uFsh4mAzcSA1OE,19881
|
112
112
|
prefect/client/schemas/__init__.py,sha256=InZcDzdeWA2oaV0TlyvoMcyLcbi_aaqU1U9D6Gx-eoU,2747
|
113
|
-
prefect/client/schemas/actions.py,sha256=
|
113
|
+
prefect/client/schemas/actions.py,sha256=n8f-qNQs-mSca_zYdpZSR4A4OwnT6pylkjVc2VwFZBc,33684
|
114
114
|
prefect/client/schemas/filters.py,sha256=zaiDkalrIpKjd38V4aP1GHlqD24KTPCZiKtPyX69ZWE,36607
|
115
115
|
prefect/client/schemas/objects.py,sha256=qEV2lIdK6JGGhNsAiUDsvtPbjdIZZABqdjnA8cMsnak,58999
|
116
116
|
prefect/client/schemas/responses.py,sha256=9x8gP2O52xEf40EbnSKaKwxS1vIg347t8CqgHGMYCNg,16664
|
@@ -231,7 +231,7 @@ prefect/server/api/ui/__init__.py,sha256=TCXO4ZUZCqCbm2QoNvWNTErkzWiX2nSACuO-0Ti
|
|
231
231
|
prefect/server/api/ui/flow_runs.py,sha256=ALmUFY4WrJggN1ha0z-tqXeddG2GptswbPnB7iYixUM,4172
|
232
232
|
prefect/server/api/ui/flows.py,sha256=W4kwqOCJ_2vROmMCmemH2Mq3uWbWZyu5q5uTZPBdYwk,5902
|
233
233
|
prefect/server/api/ui/schemas.py,sha256=NVWA1RFnHW-MMU1s6WbNmp_S5mhbrN-_P41I4O2XtMg,2085
|
234
|
-
prefect/server/api/ui/task_runs.py,sha256=
|
234
|
+
prefect/server/api/ui/task_runs.py,sha256=6CMrHmY-ybJGHXz7YlVVP2ZTmvq7w-XA9GUHqCcw_7o,7319
|
235
235
|
prefect/settings/__init__.py,sha256=3jDLzExmq9HsRWo1kTSE16BO_3B3JlVsk5pR0s4PWEQ,2136
|
236
236
|
prefect/settings/base.py,sha256=HGukXOXOokfqmrVirgejNskKtf1x2QheZ-ldRakxPJA,9701
|
237
237
|
prefect/settings/constants.py,sha256=5NjVLG1Km9J9I-a6wrq-qmi_dTkPdwEk3IrY9bSxWvw,281
|
@@ -316,7 +316,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
|
|
316
316
|
prefect/workers/process.py,sha256=uxOwcqA2Ps-V-W6WeSdKCQMINrCxBEVx1K1Un8pb7vs,8973
|
317
317
|
prefect/workers/server.py,sha256=2pmVeJZiVbEK02SO6BEZaBIvHMsn6G8LzjW8BXyiTtk,1952
|
318
318
|
prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
|
319
|
-
prefect_client-3.3.
|
320
|
-
prefect_client-3.3.
|
321
|
-
prefect_client-3.3.
|
322
|
-
prefect_client-3.3.
|
319
|
+
prefect_client-3.3.3.dev1.dist-info/METADATA,sha256=WlCSo0IoVks5TpfKQFqnzyaAAl2aW-5hZxDR3YlMp8s,7456
|
320
|
+
prefect_client-3.3.3.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
321
|
+
prefect_client-3.3.3.dev1.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
322
|
+
prefect_client-3.3.3.dev1.dist-info/RECORD,,
|
File without changes
|
{prefect_client-3.3.2.dev2.dist-info → prefect_client-3.3.3.dev1.dist-info}/licenses/LICENSE
RENAMED
File without changes
|