flyte 2.0.0b32__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.
Potentially problematic release.
This version of flyte might be problematic. Click here for more details.
- flyte/__init__.py +108 -0
- flyte/_bin/__init__.py +0 -0
- flyte/_bin/debug.py +38 -0
- flyte/_bin/runtime.py +195 -0
- flyte/_bin/serve.py +178 -0
- flyte/_build.py +26 -0
- flyte/_cache/__init__.py +12 -0
- flyte/_cache/cache.py +147 -0
- flyte/_cache/defaults.py +9 -0
- flyte/_cache/local_cache.py +216 -0
- flyte/_cache/policy_function_body.py +42 -0
- flyte/_code_bundle/__init__.py +8 -0
- flyte/_code_bundle/_ignore.py +121 -0
- flyte/_code_bundle/_packaging.py +218 -0
- flyte/_code_bundle/_utils.py +347 -0
- flyte/_code_bundle/bundle.py +266 -0
- flyte/_constants.py +1 -0
- flyte/_context.py +155 -0
- flyte/_custom_context.py +73 -0
- flyte/_debug/__init__.py +0 -0
- flyte/_debug/constants.py +38 -0
- flyte/_debug/utils.py +17 -0
- flyte/_debug/vscode.py +307 -0
- flyte/_deploy.py +408 -0
- flyte/_deployer.py +109 -0
- flyte/_doc.py +29 -0
- flyte/_docstring.py +32 -0
- flyte/_environment.py +122 -0
- flyte/_excepthook.py +37 -0
- flyte/_group.py +32 -0
- flyte/_hash.py +8 -0
- flyte/_image.py +1055 -0
- flyte/_initialize.py +628 -0
- flyte/_interface.py +119 -0
- flyte/_internal/__init__.py +3 -0
- flyte/_internal/controllers/__init__.py +129 -0
- flyte/_internal/controllers/_local_controller.py +239 -0
- flyte/_internal/controllers/_trace.py +48 -0
- flyte/_internal/controllers/remote/__init__.py +58 -0
- flyte/_internal/controllers/remote/_action.py +211 -0
- flyte/_internal/controllers/remote/_client.py +47 -0
- flyte/_internal/controllers/remote/_controller.py +583 -0
- flyte/_internal/controllers/remote/_core.py +465 -0
- flyte/_internal/controllers/remote/_informer.py +381 -0
- flyte/_internal/controllers/remote/_service_protocol.py +50 -0
- flyte/_internal/imagebuild/__init__.py +3 -0
- flyte/_internal/imagebuild/docker_builder.py +706 -0
- flyte/_internal/imagebuild/image_builder.py +277 -0
- flyte/_internal/imagebuild/remote_builder.py +386 -0
- flyte/_internal/imagebuild/utils.py +78 -0
- flyte/_internal/resolvers/__init__.py +0 -0
- flyte/_internal/resolvers/_task_module.py +21 -0
- flyte/_internal/resolvers/common.py +31 -0
- flyte/_internal/resolvers/default.py +28 -0
- flyte/_internal/runtime/__init__.py +0 -0
- flyte/_internal/runtime/convert.py +486 -0
- flyte/_internal/runtime/entrypoints.py +204 -0
- flyte/_internal/runtime/io.py +188 -0
- flyte/_internal/runtime/resources_serde.py +152 -0
- flyte/_internal/runtime/reuse.py +125 -0
- flyte/_internal/runtime/rusty.py +193 -0
- flyte/_internal/runtime/task_serde.py +362 -0
- flyte/_internal/runtime/taskrunner.py +209 -0
- flyte/_internal/runtime/trigger_serde.py +160 -0
- flyte/_internal/runtime/types_serde.py +54 -0
- flyte/_keyring/__init__.py +0 -0
- flyte/_keyring/file.py +115 -0
- flyte/_logging.py +300 -0
- flyte/_map.py +312 -0
- flyte/_module.py +72 -0
- flyte/_pod.py +30 -0
- flyte/_resources.py +473 -0
- flyte/_retry.py +32 -0
- flyte/_reusable_environment.py +102 -0
- flyte/_run.py +724 -0
- flyte/_secret.py +96 -0
- flyte/_task.py +550 -0
- flyte/_task_environment.py +316 -0
- flyte/_task_plugins.py +47 -0
- flyte/_timeout.py +47 -0
- flyte/_tools.py +27 -0
- flyte/_trace.py +119 -0
- flyte/_trigger.py +1000 -0
- flyte/_utils/__init__.py +30 -0
- flyte/_utils/asyn.py +121 -0
- flyte/_utils/async_cache.py +139 -0
- flyte/_utils/coro_management.py +27 -0
- flyte/_utils/docker_credentials.py +173 -0
- flyte/_utils/file_handling.py +72 -0
- flyte/_utils/helpers.py +134 -0
- flyte/_utils/lazy_module.py +54 -0
- flyte/_utils/module_loader.py +104 -0
- flyte/_utils/org_discovery.py +57 -0
- flyte/_utils/uv_script_parser.py +49 -0
- flyte/_version.py +34 -0
- flyte/app/__init__.py +22 -0
- flyte/app/_app_environment.py +157 -0
- flyte/app/_deploy.py +125 -0
- flyte/app/_input.py +160 -0
- flyte/app/_runtime/__init__.py +3 -0
- flyte/app/_runtime/app_serde.py +347 -0
- flyte/app/_types.py +101 -0
- flyte/app/extras/__init__.py +3 -0
- flyte/app/extras/_fastapi.py +151 -0
- flyte/cli/__init__.py +12 -0
- flyte/cli/_abort.py +28 -0
- flyte/cli/_build.py +114 -0
- flyte/cli/_common.py +468 -0
- flyte/cli/_create.py +371 -0
- flyte/cli/_delete.py +45 -0
- flyte/cli/_deploy.py +293 -0
- flyte/cli/_gen.py +176 -0
- flyte/cli/_get.py +370 -0
- flyte/cli/_option.py +33 -0
- flyte/cli/_params.py +554 -0
- flyte/cli/_plugins.py +209 -0
- flyte/cli/_run.py +597 -0
- flyte/cli/_serve.py +64 -0
- flyte/cli/_update.py +37 -0
- flyte/cli/_user.py +17 -0
- flyte/cli/main.py +221 -0
- flyte/config/__init__.py +3 -0
- flyte/config/_config.py +248 -0
- flyte/config/_internal.py +73 -0
- flyte/config/_reader.py +225 -0
- flyte/connectors/__init__.py +11 -0
- flyte/connectors/_connector.py +270 -0
- flyte/connectors/_server.py +197 -0
- flyte/connectors/utils.py +135 -0
- flyte/errors.py +243 -0
- flyte/extend.py +19 -0
- flyte/extras/__init__.py +5 -0
- flyte/extras/_container.py +286 -0
- flyte/git/__init__.py +3 -0
- flyte/git/_config.py +21 -0
- flyte/io/__init__.py +29 -0
- flyte/io/_dataframe/__init__.py +131 -0
- flyte/io/_dataframe/basic_dfs.py +223 -0
- flyte/io/_dataframe/dataframe.py +1026 -0
- flyte/io/_dir.py +910 -0
- flyte/io/_file.py +914 -0
- flyte/io/_hashing_io.py +342 -0
- flyte/models.py +479 -0
- flyte/py.typed +0 -0
- flyte/remote/__init__.py +35 -0
- flyte/remote/_action.py +738 -0
- flyte/remote/_app.py +57 -0
- flyte/remote/_client/__init__.py +0 -0
- flyte/remote/_client/_protocols.py +189 -0
- flyte/remote/_client/auth/__init__.py +12 -0
- flyte/remote/_client/auth/_auth_utils.py +14 -0
- flyte/remote/_client/auth/_authenticators/__init__.py +0 -0
- flyte/remote/_client/auth/_authenticators/base.py +403 -0
- flyte/remote/_client/auth/_authenticators/client_credentials.py +73 -0
- flyte/remote/_client/auth/_authenticators/device_code.py +117 -0
- flyte/remote/_client/auth/_authenticators/external_command.py +79 -0
- flyte/remote/_client/auth/_authenticators/factory.py +200 -0
- flyte/remote/_client/auth/_authenticators/pkce.py +516 -0
- flyte/remote/_client/auth/_channel.py +213 -0
- flyte/remote/_client/auth/_client_config.py +85 -0
- flyte/remote/_client/auth/_default_html.py +32 -0
- flyte/remote/_client/auth/_grpc_utils/__init__.py +0 -0
- flyte/remote/_client/auth/_grpc_utils/auth_interceptor.py +288 -0
- flyte/remote/_client/auth/_grpc_utils/default_metadata_interceptor.py +151 -0
- flyte/remote/_client/auth/_keyring.py +152 -0
- flyte/remote/_client/auth/_token_client.py +260 -0
- flyte/remote/_client/auth/errors.py +16 -0
- flyte/remote/_client/controlplane.py +128 -0
- flyte/remote/_common.py +30 -0
- flyte/remote/_console.py +19 -0
- flyte/remote/_data.py +161 -0
- flyte/remote/_logs.py +185 -0
- flyte/remote/_project.py +88 -0
- flyte/remote/_run.py +386 -0
- flyte/remote/_secret.py +142 -0
- flyte/remote/_task.py +527 -0
- flyte/remote/_trigger.py +306 -0
- flyte/remote/_user.py +33 -0
- flyte/report/__init__.py +3 -0
- flyte/report/_report.py +182 -0
- flyte/report/_template.html +124 -0
- flyte/storage/__init__.py +36 -0
- flyte/storage/_config.py +237 -0
- flyte/storage/_parallel_reader.py +274 -0
- flyte/storage/_remote_fs.py +34 -0
- flyte/storage/_storage.py +456 -0
- flyte/storage/_utils.py +5 -0
- flyte/syncify/__init__.py +56 -0
- flyte/syncify/_api.py +375 -0
- flyte/types/__init__.py +52 -0
- flyte/types/_interface.py +40 -0
- flyte/types/_pickle.py +145 -0
- flyte/types/_renderer.py +162 -0
- flyte/types/_string_literals.py +119 -0
- flyte/types/_type_engine.py +2254 -0
- flyte/types/_utils.py +80 -0
- flyte-2.0.0b32.data/scripts/debug.py +38 -0
- flyte-2.0.0b32.data/scripts/runtime.py +195 -0
- flyte-2.0.0b32.dist-info/METADATA +351 -0
- flyte-2.0.0b32.dist-info/RECORD +204 -0
- flyte-2.0.0b32.dist-info/WHEEL +5 -0
- flyte-2.0.0b32.dist-info/entry_points.txt +7 -0
- flyte-2.0.0b32.dist-info/licenses/LICENSE +201 -0
- flyte-2.0.0b32.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Literal, Optional
|
|
5
|
+
|
|
6
|
+
from flyteidl2.common import identifier_pb2
|
|
7
|
+
from flyteidl2.core import execution_pb2, interface_pb2
|
|
8
|
+
from flyteidl2.task import common_pb2, task_definition_pb2
|
|
9
|
+
from flyteidl2.workflow import (
|
|
10
|
+
run_definition_pb2,
|
|
11
|
+
state_service_pb2,
|
|
12
|
+
)
|
|
13
|
+
from google.protobuf import timestamp_pb2
|
|
14
|
+
|
|
15
|
+
from flyte.models import GroupData
|
|
16
|
+
|
|
17
|
+
ActionType = Literal["task", "trace"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class Action:
|
|
22
|
+
"""
|
|
23
|
+
Coroutine safe, as we never do await operations in any method.
|
|
24
|
+
Holds the inmemory state of a task. It is combined representation of local and remote states.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
action_id: identifier_pb2.ActionIdentifier
|
|
28
|
+
parent_action_name: str
|
|
29
|
+
type: ActionType = "task" # type of action, task or trace
|
|
30
|
+
friendly_name: str | None = None
|
|
31
|
+
group: GroupData | None = None
|
|
32
|
+
task: task_definition_pb2.TaskSpec | None = None
|
|
33
|
+
trace: run_definition_pb2.TraceAction | None = None
|
|
34
|
+
inputs_uri: str | None = None
|
|
35
|
+
run_output_base: str | None = None
|
|
36
|
+
realized_outputs_uri: str | None = None
|
|
37
|
+
err: execution_pb2.ExecutionError | None = None
|
|
38
|
+
phase: run_definition_pb2.Phase | None = None
|
|
39
|
+
started: bool = False
|
|
40
|
+
retries: int = 0
|
|
41
|
+
queue: Optional[str] = None # The queue to which this action was submitted.
|
|
42
|
+
client_err: Exception | None = None # This error is set when something goes wrong in the controller.
|
|
43
|
+
cache_key: str | None = None # None means no caching, otherwise it is the version of the cache.
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def name(self) -> str:
|
|
47
|
+
return self.action_id.name
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def run_name(self) -> str:
|
|
51
|
+
return self.action_id.run.name
|
|
52
|
+
|
|
53
|
+
def is_terminal(self) -> bool:
|
|
54
|
+
"""Check if resource has reached terminal state"""
|
|
55
|
+
if self.phase is None:
|
|
56
|
+
return False
|
|
57
|
+
return self.phase in [
|
|
58
|
+
run_definition_pb2.Phase.PHASE_FAILED,
|
|
59
|
+
run_definition_pb2.Phase.PHASE_SUCCEEDED,
|
|
60
|
+
run_definition_pb2.Phase.PHASE_ABORTED,
|
|
61
|
+
run_definition_pb2.Phase.PHASE_TIMED_OUT,
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
def increment_retries(self):
|
|
65
|
+
self.retries += 1
|
|
66
|
+
|
|
67
|
+
def is_started(self) -> bool:
|
|
68
|
+
"""Check if resource has been started."""
|
|
69
|
+
return self.started
|
|
70
|
+
|
|
71
|
+
def mark_started(self):
|
|
72
|
+
self.started = True
|
|
73
|
+
self.task = None
|
|
74
|
+
|
|
75
|
+
def mark_cancelled(self):
|
|
76
|
+
self.mark_started()
|
|
77
|
+
self.phase = run_definition_pb2.Phase.PHASE_ABORTED
|
|
78
|
+
|
|
79
|
+
def merge_state(self, obj: state_service_pb2.ActionUpdate):
|
|
80
|
+
"""
|
|
81
|
+
This method is invoked when the watch API sends an update about the state of the action. We need to merge
|
|
82
|
+
the state of the action with the current state of the action. It is possible that we have no phase information
|
|
83
|
+
prior to this.
|
|
84
|
+
:param obj:
|
|
85
|
+
:return:
|
|
86
|
+
"""
|
|
87
|
+
if self.phase != obj.phase:
|
|
88
|
+
self.phase = obj.phase
|
|
89
|
+
self.err = obj.error if obj.HasField("error") else None
|
|
90
|
+
self.realized_outputs_uri = obj.output_uri
|
|
91
|
+
self.started = True
|
|
92
|
+
|
|
93
|
+
def merge_in_action_from_submit(self, action: Action):
|
|
94
|
+
"""
|
|
95
|
+
This method is invoked when parent_action submits an action that was observed previously observed from the
|
|
96
|
+
watch. We need to merge in the contents of the action, while preserving the observed phase.
|
|
97
|
+
|
|
98
|
+
:param action: The submitted action
|
|
99
|
+
"""
|
|
100
|
+
self.run_output_base = action.run_output_base
|
|
101
|
+
self.inputs_uri = action.inputs_uri
|
|
102
|
+
self.group = action.group
|
|
103
|
+
self.friendly_name = action.friendly_name
|
|
104
|
+
if not self.started:
|
|
105
|
+
self.task = action.task
|
|
106
|
+
|
|
107
|
+
self.cache_key = action.cache_key
|
|
108
|
+
|
|
109
|
+
def set_client_error(self, exc: Exception):
|
|
110
|
+
self.client_err = exc
|
|
111
|
+
|
|
112
|
+
def has_error(self) -> bool:
|
|
113
|
+
return self.client_err is not None or self.err is not None
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_task(
|
|
117
|
+
cls,
|
|
118
|
+
parent_action_name: str,
|
|
119
|
+
sub_action_id: identifier_pb2.ActionIdentifier,
|
|
120
|
+
group_data: GroupData | None,
|
|
121
|
+
task_spec: task_definition_pb2.TaskSpec,
|
|
122
|
+
inputs_uri: str,
|
|
123
|
+
run_output_base: str,
|
|
124
|
+
cache_key: str | None = None,
|
|
125
|
+
queue: Optional[str] = None,
|
|
126
|
+
) -> Action:
|
|
127
|
+
return cls(
|
|
128
|
+
action_id=sub_action_id,
|
|
129
|
+
parent_action_name=parent_action_name,
|
|
130
|
+
friendly_name=task_spec.task_template.id.name,
|
|
131
|
+
group=group_data,
|
|
132
|
+
task=task_spec,
|
|
133
|
+
inputs_uri=inputs_uri,
|
|
134
|
+
run_output_base=run_output_base,
|
|
135
|
+
cache_key=cache_key,
|
|
136
|
+
queue=queue,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
@classmethod
|
|
140
|
+
def from_state(cls, parent_action_name: str, obj: state_service_pb2.ActionUpdate) -> Action:
|
|
141
|
+
"""
|
|
142
|
+
This creates a new action, from the watch api. This is possible in the case of a recovery, where the
|
|
143
|
+
state service knows about future actions and sends this information to the informer. We may not have
|
|
144
|
+
encountered the "task" itself yet, but we know about the action id and the state of the action.
|
|
145
|
+
|
|
146
|
+
:param parent_action_name:
|
|
147
|
+
:param obj:
|
|
148
|
+
:return:
|
|
149
|
+
"""
|
|
150
|
+
from flyte._logging import logger
|
|
151
|
+
|
|
152
|
+
logger.debug(f"In Action from_state {obj.action_id} {obj.phase} {obj.output_uri}")
|
|
153
|
+
return cls(
|
|
154
|
+
action_id=obj.action_id,
|
|
155
|
+
parent_action_name=parent_action_name,
|
|
156
|
+
phase=obj.phase,
|
|
157
|
+
started=True,
|
|
158
|
+
err=obj.error if obj.HasField("error") else None,
|
|
159
|
+
realized_outputs_uri=obj.output_uri,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
@classmethod
|
|
163
|
+
def from_trace(
|
|
164
|
+
cls,
|
|
165
|
+
parent_action_name: str,
|
|
166
|
+
action_id: identifier_pb2.ActionIdentifier,
|
|
167
|
+
friendly_name: str,
|
|
168
|
+
group_data: GroupData | None,
|
|
169
|
+
inputs_uri: str,
|
|
170
|
+
outputs_uri: str,
|
|
171
|
+
start_time: float, # Unix timestamp in seconds with fractional seconds
|
|
172
|
+
end_time: float, # Unix timestamp in seconds with fractional seconds
|
|
173
|
+
run_output_base: str,
|
|
174
|
+
report_uri: str | None = None,
|
|
175
|
+
typed_interface: interface_pb2.TypedInterface | None = None,
|
|
176
|
+
) -> Action:
|
|
177
|
+
"""
|
|
178
|
+
This creates a new action for tracing purposes. It is used to track the execution of a trace.
|
|
179
|
+
"""
|
|
180
|
+
st = timestamp_pb2.Timestamp()
|
|
181
|
+
st.FromSeconds(int(start_time))
|
|
182
|
+
st.nanos = int((start_time % 1) * 1e9)
|
|
183
|
+
|
|
184
|
+
et = timestamp_pb2.Timestamp()
|
|
185
|
+
et.FromSeconds(int(end_time))
|
|
186
|
+
et.nanos = int((end_time % 1) * 1e9)
|
|
187
|
+
|
|
188
|
+
spec = task_definition_pb2.TraceSpec(interface=typed_interface) if typed_interface else None
|
|
189
|
+
|
|
190
|
+
return cls(
|
|
191
|
+
action_id=action_id,
|
|
192
|
+
parent_action_name=parent_action_name,
|
|
193
|
+
type="trace",
|
|
194
|
+
friendly_name=friendly_name,
|
|
195
|
+
group=group_data,
|
|
196
|
+
inputs_uri=inputs_uri,
|
|
197
|
+
realized_outputs_uri=outputs_uri,
|
|
198
|
+
phase=run_definition_pb2.Phase.PHASE_SUCCEEDED,
|
|
199
|
+
run_output_base=run_output_base,
|
|
200
|
+
trace=run_definition_pb2.TraceAction(
|
|
201
|
+
name=friendly_name,
|
|
202
|
+
phase=run_definition_pb2.Phase.PHASE_SUCCEEDED,
|
|
203
|
+
start_time=st,
|
|
204
|
+
end_time=et,
|
|
205
|
+
outputs=common_pb2.OutputReferences(
|
|
206
|
+
output_uri=outputs_uri,
|
|
207
|
+
report_uri=report_uri,
|
|
208
|
+
),
|
|
209
|
+
spec=spec,
|
|
210
|
+
),
|
|
211
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import grpc.aio
|
|
4
|
+
from flyteidl2.workflow import queue_service_pb2_grpc, state_service_pb2_grpc
|
|
5
|
+
|
|
6
|
+
from flyte.remote import create_channel
|
|
7
|
+
|
|
8
|
+
from ._service_protocol import QueueService, StateService
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ControllerClient:
|
|
12
|
+
"""
|
|
13
|
+
A client for the Controller API.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, channel: grpc.aio.Channel):
|
|
17
|
+
self._channel = channel
|
|
18
|
+
self._state_service = state_service_pb2_grpc.StateServiceStub(channel=channel)
|
|
19
|
+
self._queue_service = queue_service_pb2_grpc.QueueServiceStub(channel=channel)
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
async def for_endpoint(cls, endpoint: str, insecure: bool = False, **kwargs) -> ControllerClient:
|
|
23
|
+
return cls(await create_channel(endpoint, None, insecure=insecure, **kwargs))
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
async def for_api_key(cls, api_key: str, insecure: bool = False, **kwargs) -> ControllerClient:
|
|
27
|
+
return cls(await create_channel(None, api_key, insecure=insecure, **kwargs))
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def state_service(self) -> StateService:
|
|
31
|
+
"""
|
|
32
|
+
The state service.
|
|
33
|
+
"""
|
|
34
|
+
return self._state_service
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def queue_service(self) -> QueueService:
|
|
38
|
+
"""
|
|
39
|
+
The queue service.
|
|
40
|
+
"""
|
|
41
|
+
return self._queue_service
|
|
42
|
+
|
|
43
|
+
def close(self, grace: float | None = None):
|
|
44
|
+
"""
|
|
45
|
+
Close the channel.
|
|
46
|
+
"""
|
|
47
|
+
return self._channel.close(grace=grace)
|