prefect-client 3.3.6.dev4__py3-none-any.whl → 3.3.7.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  # Generated by versioningit
2
- __version__ = "3.3.6.dev4"
3
- __build_date__ = "2025-04-24 08:08:45.298549+00:00"
4
- __git_commit__ = "cd2bf96d18276663c433a99c1e0f1191c100de5f"
2
+ __version__ = "3.3.7.dev1"
3
+ __build_date__ = "2025-04-26 08:07:02.330443+00:00"
4
+ __git_commit__ = "cd10dc7dbb1bf043aeec4d2b21cd3e68742f474a"
5
5
  __dirty__ = False
@@ -174,13 +174,13 @@ class EventLoopThread(Portal):
174
174
  # Track the portal running the call
175
175
  call.set_runner(self)
176
176
 
177
+ if self._run_once:
178
+ call.future.add_done_callback(lambda _: self.shutdown())
179
+
177
180
  # Submit the call to the event loop
178
181
  assert self._loop is not None
179
182
  asyncio.run_coroutine_threadsafe(self._run_call(call), self._loop)
180
-
181
183
  self._submitted_count += 1
182
- if self._run_once:
183
- call.future.add_done_callback(lambda _: self.shutdown())
184
184
 
185
185
  return call
186
186
 
prefect/_versioning.py CHANGED
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  import os
4
4
  from enum import Enum
5
5
  from typing import Any, Callable, Coroutine, Dict, Literal, Optional
6
+ from urllib.parse import urlparse
6
7
 
7
8
  from anyio import run_process
8
9
  from pydantic import Field, model_validator
@@ -49,7 +50,7 @@ async def get_github_version_info(
49
50
 
50
51
  Args:
51
52
  version: The commit SHA, falls back to GITHUB_SHA env var
52
- branch: The git branch, falls back to GITHUB_REF env var
53
+ branch: The git branch, falls back to GITHUB_REF_NAME env var
53
54
  repository: The repository name, falls back to GITHUB_REPOSITORY env var
54
55
  url: The repository URL, constructed from GITHUB_SERVER_URL/GITHUB_REPOSITORY if not provided
55
56
 
@@ -60,14 +61,16 @@ async def get_github_version_info(
60
61
  ValueError: If any required fields cannot be determined
61
62
  """
62
63
  version = version or os.getenv("GITHUB_SHA")
63
- branch = branch or os.getenv("GITHUB_REF")
64
+ branch = branch or os.getenv("GITHUB_REF_NAME")
64
65
  repository = repository or os.getenv("GITHUB_REPOSITORY")
65
66
  url = url or f"{os.getenv('GITHUB_SERVER_URL')}/{repository}"
66
67
 
67
68
  if not version:
68
69
  raise ValueError("version is required - must be provided or set in GITHUB_SHA")
69
70
  if not branch:
70
- raise ValueError("branch is required - must be provided or set in GITHUB_REF")
71
+ raise ValueError(
72
+ "branch is required - must be provided or set in GITHUB_REF_NAME"
73
+ )
71
74
  if not repository:
72
75
  raise ValueError(
73
76
  "repository is required - must be provided or set in GITHUB_REPOSITORY"
@@ -104,8 +107,10 @@ async def get_git_version_info(
104
107
  remote_url = result.stdout.decode().strip()
105
108
 
106
109
  # Extract just the repository name (last part of the path)
107
- repo_name = os.path.basename(remote_url.split(":")[1].rstrip(".git"))
108
- repository = repo_name
110
+ repo_url = urlparse(remote_url)
111
+ repository = repo_url.path.strip("/")
112
+ if repository.endswith(".git"):
113
+ repository = repository[:-4]
109
114
 
110
115
  if not url and repository:
111
116
  # Use the full remote URL as the URL
prefect/flows.py CHANGED
@@ -65,7 +65,7 @@ from prefect.exceptions import (
65
65
  UnspecifiedFlowError,
66
66
  )
67
67
  from prefect.filesystems import LocalFileSystem, ReadableDeploymentStorage
68
- from prefect.futures import PrefectFuture
68
+ from prefect.futures import PrefectFlowRunFuture, PrefectFuture
69
69
  from prefect.logging import get_logger
70
70
  from prefect.logging.loggers import flow_run_logger
71
71
  from prefect.results import ResultSerializer, ResultStorage
@@ -2104,6 +2104,106 @@ class InfrastructureBoundFlow(Flow[P, R]):
2104
2104
  )
2105
2105
  )
2106
2106
 
2107
+ def submit(self, *args: P.args, **kwargs: P.kwargs) -> PrefectFlowRunFuture[R]:
2108
+ """
2109
+ EXPERIMENTAL: This method is experimental and may be removed or changed in future
2110
+ releases.
2111
+
2112
+ Submit the flow to run on remote infrastructure.
2113
+
2114
+ Args:
2115
+ *args: Positional arguments to pass to the flow.
2116
+ **kwargs: Keyword arguments to pass to the flow.
2117
+
2118
+ Returns:
2119
+ A `PrefectFlowRunFuture` that can be used to retrieve the result of the flow run.
2120
+
2121
+ Examples:
2122
+ Submit a flow to run on Kubernetes:
2123
+
2124
+ ```python
2125
+ from prefect import flow
2126
+ from prefect_kubernetes.experimental import kubernetes
2127
+
2128
+ @kubernetes(work_pool="my-kubernetes-work-pool")
2129
+ @flow
2130
+ def my_flow(x: int, y: int):
2131
+ return x + y
2132
+
2133
+ future = my_flow.submit(x=1, y=2)
2134
+ result = future.result()
2135
+ print(result)
2136
+ ```
2137
+ """
2138
+
2139
+ async def submit_func():
2140
+ async with self.worker_cls(work_pool_name=self.work_pool) as worker:
2141
+ parameters = get_call_parameters(self, args, kwargs)
2142
+ return await worker.submit(
2143
+ flow=self,
2144
+ parameters=parameters,
2145
+ job_variables=self.job_variables,
2146
+ )
2147
+
2148
+ return run_coro_as_sync(submit_func())
2149
+
2150
+ def with_options(
2151
+ self,
2152
+ *,
2153
+ name: Optional[str] = None,
2154
+ version: Optional[str] = None,
2155
+ retries: Optional[int] = None,
2156
+ retry_delay_seconds: Optional[Union[int, float]] = None,
2157
+ description: Optional[str] = None,
2158
+ flow_run_name: Optional[Union[Callable[[], str], str]] = None,
2159
+ task_runner: Union[
2160
+ Type[TaskRunner[PrefectFuture[Any]]], TaskRunner[PrefectFuture[Any]], None
2161
+ ] = None,
2162
+ timeout_seconds: Union[int, float, None] = None,
2163
+ validate_parameters: Optional[bool] = None,
2164
+ persist_result: Optional[bool] = NotSet, # type: ignore
2165
+ result_storage: Optional[ResultStorage] = NotSet, # type: ignore
2166
+ result_serializer: Optional[ResultSerializer] = NotSet, # type: ignore
2167
+ cache_result_in_memory: Optional[bool] = None,
2168
+ log_prints: Optional[bool] = NotSet, # type: ignore
2169
+ on_completion: Optional[list[FlowStateHook[P, R]]] = None,
2170
+ on_failure: Optional[list[FlowStateHook[P, R]]] = None,
2171
+ on_cancellation: Optional[list[FlowStateHook[P, R]]] = None,
2172
+ on_crashed: Optional[list[FlowStateHook[P, R]]] = None,
2173
+ on_running: Optional[list[FlowStateHook[P, R]]] = None,
2174
+ job_variables: Optional[dict[str, Any]] = None,
2175
+ ) -> "InfrastructureBoundFlow[P, R]":
2176
+ new_flow = super().with_options(
2177
+ name=name,
2178
+ version=version,
2179
+ retries=retries,
2180
+ retry_delay_seconds=retry_delay_seconds,
2181
+ description=description,
2182
+ flow_run_name=flow_run_name,
2183
+ task_runner=task_runner,
2184
+ timeout_seconds=timeout_seconds,
2185
+ validate_parameters=validate_parameters,
2186
+ persist_result=persist_result,
2187
+ result_storage=result_storage,
2188
+ result_serializer=result_serializer,
2189
+ cache_result_in_memory=cache_result_in_memory,
2190
+ log_prints=log_prints,
2191
+ on_completion=on_completion,
2192
+ on_failure=on_failure,
2193
+ on_cancellation=on_cancellation,
2194
+ on_crashed=on_crashed,
2195
+ on_running=on_running,
2196
+ )
2197
+ new_infrastructure_bound_flow = bind_flow_to_infrastructure(
2198
+ new_flow,
2199
+ self.work_pool,
2200
+ self.worker_cls,
2201
+ job_variables=job_variables
2202
+ if job_variables is not None
2203
+ else self.job_variables,
2204
+ )
2205
+ return new_infrastructure_bound_flow
2206
+
2107
2207
 
2108
2208
  def bind_flow_to_infrastructure(
2109
2209
  flow: Flow[P, R],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.3.6.dev4
3
+ Version: 3.3.7.dev1
4
4
  Summary: Workflow orchestration and management.
5
5
  Project-URL: Changelog, https://github.com/PrefectHQ/prefect/releases
6
6
  Project-URL: Documentation, https://docs.prefect.io
@@ -1,9 +1,9 @@
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=zUk4_brUMO3gk7qftKtl1X8H2yE2LpC3NTQ0fZgfi9E,185
4
+ prefect/_build_info.py,sha256=i0HPiKMTjulMHgGQpiIFlOuoBNgT7XxvbU9bkw5QsaQ,185
5
5
  prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
6
- prefect/_versioning.py,sha256=4zp4Dl9dJWsoItj4AAhRxYtP3CMdo-7nG0dyv3Xz4nU,5361
6
+ prefect/_versioning.py,sha256=Bm2EwEODvMe_kLkeVXy32BaTA_4ijBZl9eFbdtXEV4w,5498
7
7
  prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
8
8
  prefect/agent.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
9
9
  prefect/artifacts.py,sha256=dMBUOAWnUamzjb5HSqwB5-GR2Qb-Gxee26XG5NDCUuw,22720
@@ -15,7 +15,7 @@ prefect/exceptions.py,sha256=wZLQQMRB_DyiYkeEdIC5OKwbba5A94Dlnics-lrWI7A,11581
15
15
  prefect/filesystems.py,sha256=v5YqGB4uXf9Ew2VuB9VCSkawvYMMVvEtZf7w1VmAmr8,18036
16
16
  prefect/flow_engine.py,sha256=hZpTYEtwTPMtwVoTCrfD93igN7rlKeG_0kyCvdU4aYE,58876
17
17
  prefect/flow_runs.py,sha256=dbHcXsOq1UsNM7vyJV9gboCTylmdUwQ_-W4NQt4R4ds,17267
18
- prefect/flows.py,sha256=8gWWoZB8S8j8Iwz0TTc5F-f_8sTFucGm53aaue5vUi4,114116
18
+ prefect/flows.py,sha256=UCBwsb99wtPTGPu2PneKCfAMlMBA2GhXJb5rzMBxw1s,118041
19
19
  prefect/futures.py,sha256=F4eplqRcqw5-aMNKu6-lOFOWdDNr0RGrPso4C4G02bU,24248
20
20
  prefect/main.py,sha256=8V-qLB4GjEVCkGRgGXeaIk-JIXY8Z9FozcNluj4Sm9E,2589
21
21
  prefect/plugins.py,sha256=FPRLR2mWVBMuOnlzeiTD9krlHONZH2rtYLD753JQDNQ,2516
@@ -55,7 +55,7 @@ prefect/_internal/concurrency/event_loop.py,sha256=N6SyBV0vaSF5HD4_JM8zL7oBGd2nM
55
55
  prefect/_internal/concurrency/inspection.py,sha256=wUWVbHi4G-BxuuYFWhTNmo5yc1C651lQrp5OMiHPU1E,3545
56
56
  prefect/_internal/concurrency/primitives.py,sha256=Wuht4GwJCgts_uAZFUt9c-InPssnXcelRQc1dGdOplk,2672
57
57
  prefect/_internal/concurrency/services.py,sha256=w2J5Q5Pep19Ignx-TLEw27wf3fS26HVw-eeR4xMeTxQ,16174
58
- prefect/_internal/concurrency/threads.py,sha256=9sIDBdVFmvY4qqdkz3p1eqs4se7Ua2lJ-CPnhTSPRs4,9288
58
+ prefect/_internal/concurrency/threads.py,sha256=id4T2Jc0K1yLL8dOoh6bqV_-8tZEa1w58WXGn0X7efk,9288
59
59
  prefect/_internal/concurrency/waiters.py,sha256=mhXpQk8swcUAxBk7f7kGn1fqy44XcFyneog_zEYecr0,9442
60
60
  prefect/_internal/pydantic/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
61
61
  prefect/_internal/pydantic/schemas.py,sha256=tsRKq5yEIgiRbWMl3BPnbfNaKyDN6pq8WSs0M8SQMm4,452
@@ -319,7 +319,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
319
319
  prefect/workers/process.py,sha256=Yi5D0U5AQ51wHT86GdwtImXSefe0gJf3LGq4r4z9zwM,11090
320
320
  prefect/workers/server.py,sha256=2pmVeJZiVbEK02SO6BEZaBIvHMsn6G8LzjW8BXyiTtk,1952
321
321
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
322
- prefect_client-3.3.6.dev4.dist-info/METADATA,sha256=RsEw_afSzFcD5K033alWN4wcgZBKx3xYewDGIk6R5hE,7471
323
- prefect_client-3.3.6.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
324
- prefect_client-3.3.6.dev4.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
325
- prefect_client-3.3.6.dev4.dist-info/RECORD,,
322
+ prefect_client-3.3.7.dev1.dist-info/METADATA,sha256=6FAsM6aa3xPIf5zF4f_6xMRxothgGC5_xux_C1UJU8I,7471
323
+ prefect_client-3.3.7.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
324
+ prefect_client-3.3.7.dev1.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
325
+ prefect_client-3.3.7.dev1.dist-info/RECORD,,