flyte 0.2.0b24__py3-none-any.whl → 0.2.0b26__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/_internal/imagebuild/docker_builder.py +5 -1
- flyte/_internal/imagebuild/remote_builder.py +11 -3
- flyte/_internal/runtime/convert.py +16 -0
- flyte/_internal/runtime/entrypoints.py +58 -15
- flyte/_internal/runtime/reuse.py +121 -0
- flyte/_internal/runtime/rusty.py +165 -0
- flyte/_internal/runtime/task_serde.py +24 -34
- flyte/_reusable_environment.py +57 -2
- flyte/_secret.py +30 -0
- flyte/_task.py +0 -5
- flyte/_task_environment.py +14 -1
- flyte/_version.py +2 -2
- flyte/cli/_get.py +11 -8
- flyte/models.py +10 -1
- flyte/remote/__init__.py +2 -1
- flyte/remote/_action.py +698 -0
- flyte/remote/_project.py +5 -4
- flyte/remote/_run.py +3 -658
- {flyte-0.2.0b24.dist-info → flyte-0.2.0b26.dist-info}/METADATA +1 -1
- {flyte-0.2.0b24.dist-info → flyte-0.2.0b26.dist-info}/RECORD +24 -21
- {flyte-0.2.0b24.data → flyte-0.2.0b26.data}/scripts/runtime.py +0 -0
- {flyte-0.2.0b24.dist-info → flyte-0.2.0b26.dist-info}/WHEEL +0 -0
- {flyte-0.2.0b24.dist-info → flyte-0.2.0b26.dist-info}/entry_points.txt +0 -0
- {flyte-0.2.0b24.dist-info → flyte-0.2.0b26.dist-info}/top_level.txt +0 -0
flyte/_task.py
CHANGED
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import weakref
|
|
5
5
|
from dataclasses import dataclass, field, replace
|
|
6
|
-
from functools import cached_property
|
|
7
6
|
from inspect import iscoroutinefunction
|
|
8
7
|
from typing import (
|
|
9
8
|
TYPE_CHECKING,
|
|
@@ -368,10 +367,6 @@ class AsyncFunctionTaskTemplate(TaskTemplate[P, R]):
|
|
|
368
367
|
if not iscoroutinefunction(self.func):
|
|
369
368
|
self._call_as_synchronous = True
|
|
370
369
|
|
|
371
|
-
@cached_property
|
|
372
|
-
def native_interface(self) -> NativeInterface:
|
|
373
|
-
return NativeInterface.from_callable(self.func)
|
|
374
|
-
|
|
375
370
|
def forward(self, *args: P.args, **kwargs: P.kwargs) -> Coroutine[Any, Any, R] | R:
|
|
376
371
|
# In local execution, we want to just call the function. Note we're not awaiting anything here.
|
|
377
372
|
# If the function was a coroutine function, the coroutine is returned and the await that the caller has
|
flyte/_task_environment.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import inspect
|
|
3
4
|
import weakref
|
|
4
5
|
from dataclasses import dataclass, field, replace
|
|
5
6
|
from datetime import timedelta
|
|
@@ -68,6 +69,11 @@ class TaskEnvironment(Environment):
|
|
|
68
69
|
|
|
69
70
|
_tasks: Dict[str, TaskTemplate] = field(default_factory=dict, init=False)
|
|
70
71
|
|
|
72
|
+
def __post_init__(self) -> None:
|
|
73
|
+
super().__post_init__()
|
|
74
|
+
if self.reusable is not None and self.plugin_config is not None:
|
|
75
|
+
raise ValueError("Cannot set plugin_config when environment is reusable.")
|
|
76
|
+
|
|
71
77
|
def clone_with(
|
|
72
78
|
self,
|
|
73
79
|
name: str,
|
|
@@ -144,6 +150,13 @@ class TaskEnvironment(Environment):
|
|
|
144
150
|
friendly_name = name or func.__name__
|
|
145
151
|
task_name = self.name + "." + func.__name__
|
|
146
152
|
|
|
153
|
+
if not inspect.iscoroutinefunction(func) and self.reusable is not None:
|
|
154
|
+
if self.reusable.concurrency > 1:
|
|
155
|
+
raise ValueError(
|
|
156
|
+
"Reusable environments with concurrency greater than 1 are only supported for async tasks. "
|
|
157
|
+
"Please use an async function or set concurrency to 1."
|
|
158
|
+
)
|
|
159
|
+
|
|
147
160
|
if self.plugin_config is not None:
|
|
148
161
|
from flyte.extend import TaskPluginRegistry
|
|
149
162
|
|
|
@@ -156,7 +169,7 @@ class TaskEnvironment(Environment):
|
|
|
156
169
|
f"Please register a plugin using flyte.extend.TaskPluginRegistry.register() api."
|
|
157
170
|
)
|
|
158
171
|
else:
|
|
159
|
-
task_template_class = AsyncFunctionTaskTemplate
|
|
172
|
+
task_template_class = AsyncFunctionTaskTemplate[P, R]
|
|
160
173
|
|
|
161
174
|
task_template_class = cast(type[AsyncFunctionTaskTemplate[P, R]], task_template_class)
|
|
162
175
|
tmpl = task_template_class(
|
flyte/_version.py
CHANGED
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.2.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 2, 0, '
|
|
20
|
+
__version__ = version = '0.2.0b26'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 2, 0, 'b26')
|
flyte/cli/_get.py
CHANGED
|
@@ -5,6 +5,8 @@ import rich_click as click
|
|
|
5
5
|
from rich.console import Console
|
|
6
6
|
from rich.pretty import pretty_repr
|
|
7
7
|
|
|
8
|
+
import flyte.remote._action
|
|
9
|
+
|
|
8
10
|
from . import _common as common
|
|
9
11
|
|
|
10
12
|
|
|
@@ -122,17 +124,18 @@ def action(
|
|
|
122
124
|
"""
|
|
123
125
|
Get all actions for a run or details for a specific action.
|
|
124
126
|
"""
|
|
125
|
-
import flyte.remote as remote
|
|
126
127
|
|
|
127
128
|
cfg.init(project=project, domain=domain)
|
|
128
129
|
|
|
129
130
|
console = Console()
|
|
130
131
|
if action_name:
|
|
131
|
-
console.print(pretty_repr(remote.Action.get(run_name=run_name, name=action_name)))
|
|
132
|
+
console.print(pretty_repr(flyte.remote._action.Action.get(run_name=run_name, name=action_name)))
|
|
132
133
|
else:
|
|
133
134
|
# List all actions for the run
|
|
134
135
|
console.print(
|
|
135
|
-
common.get_table(
|
|
136
|
+
common.get_table(
|
|
137
|
+
f"Actions for {run_name}", flyte.remote._action.Action.listall(for_run_name=run_name), simple=cfg.simple
|
|
138
|
+
)
|
|
136
139
|
)
|
|
137
140
|
|
|
138
141
|
|
|
@@ -201,7 +204,7 @@ def logs(
|
|
|
201
204
|
task.cancel()
|
|
202
205
|
|
|
203
206
|
if action_name:
|
|
204
|
-
obj = remote.Action.get(run_name=run_name, name=action_name)
|
|
207
|
+
obj = flyte.remote._action.Action.get(run_name=run_name, name=action_name)
|
|
205
208
|
else:
|
|
206
209
|
obj = remote.Run.get(run_name)
|
|
207
210
|
asyncio.run(_run_log_view(obj))
|
|
@@ -269,20 +272,20 @@ def io(
|
|
|
269
272
|
cfg.init(project=project, domain=domain)
|
|
270
273
|
console = Console()
|
|
271
274
|
if action_name:
|
|
272
|
-
obj = remote.ActionDetails.get(run_name=run_name, name=action_name)
|
|
275
|
+
obj = flyte.remote._action.ActionDetails.get(run_name=run_name, name=action_name)
|
|
273
276
|
else:
|
|
274
277
|
obj = remote.RunDetails.get(run_name)
|
|
275
278
|
|
|
276
279
|
async def _get_io(
|
|
277
|
-
details: Union[remote.RunDetails, remote.ActionDetails],
|
|
278
|
-
) -> Tuple[remote.ActionInputs | None, remote.ActionOutputs | None | str]:
|
|
280
|
+
details: Union[remote.RunDetails, flyte.remote._action.ActionDetails],
|
|
281
|
+
) -> Tuple[flyte.remote._action.ActionInputs | None, flyte.remote._action.ActionOutputs | None | str]:
|
|
279
282
|
if inputs_only or outputs_only:
|
|
280
283
|
if inputs_only:
|
|
281
284
|
return await details.inputs(), None
|
|
282
285
|
elif outputs_only:
|
|
283
286
|
return None, await details.outputs()
|
|
284
287
|
inputs = await details.inputs()
|
|
285
|
-
outputs: remote.ActionOutputs | None | str = None
|
|
288
|
+
outputs: flyte.remote._action.ActionOutputs | None | str = None
|
|
286
289
|
try:
|
|
287
290
|
outputs = await details.outputs()
|
|
288
291
|
except Exception:
|
flyte/models.py
CHANGED
|
@@ -256,6 +256,7 @@ class NativeInterface:
|
|
|
256
256
|
_remote_defaults: Optional[Dict[str, literals_pb2.Literal]] = field(default=None, repr=False)
|
|
257
257
|
|
|
258
258
|
has_default: ClassVar[Type[_has_default]] = _has_default # This can be used to indicate if a specific input
|
|
259
|
+
|
|
259
260
|
# has a default value or not, in the case when the default value is not known. An example would be remote tasks.
|
|
260
261
|
|
|
261
262
|
def has_outputs(self) -> bool:
|
|
@@ -298,7 +299,15 @@ class NativeInterface:
|
|
|
298
299
|
sig = inspect.signature(func)
|
|
299
300
|
|
|
300
301
|
# Extract parameter details (name, type, default value)
|
|
301
|
-
param_info = {
|
|
302
|
+
param_info = {}
|
|
303
|
+
for name, param in sig.parameters.items():
|
|
304
|
+
if param.kind in (inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD):
|
|
305
|
+
raise ValueError(f"Function {func.__name__} cannot have variable positional or keyword arguments.")
|
|
306
|
+
if param.annotation is inspect.Parameter.empty:
|
|
307
|
+
logger.warning(
|
|
308
|
+
f"Function {func.__name__} has parameter {name} without type annotation. Data will be pickled."
|
|
309
|
+
)
|
|
310
|
+
param_info[name] = (param.annotation, param.default)
|
|
302
311
|
|
|
303
312
|
# Get return type
|
|
304
313
|
outputs = extract_return_annotation(sig.return_annotation)
|
flyte/remote/__init__.py
CHANGED
|
@@ -18,9 +18,10 @@ __all__ = [
|
|
|
18
18
|
"upload_file",
|
|
19
19
|
]
|
|
20
20
|
|
|
21
|
+
from ._action import Action, ActionDetails, ActionInputs, ActionOutputs
|
|
21
22
|
from ._client.auth import create_channel
|
|
22
23
|
from ._data import upload_dir, upload_file
|
|
23
24
|
from ._project import Project
|
|
24
|
-
from ._run import
|
|
25
|
+
from ._run import Run, RunDetails
|
|
25
26
|
from ._secret import Secret, SecretTypes
|
|
26
27
|
from ._task import Task
|