flyte 0.0.1b3__py3-none-any.whl → 0.2.0a0__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 +20 -4
- flyte/_bin/runtime.py +33 -7
- flyte/_build.py +3 -2
- flyte/_cache/cache.py +1 -2
- flyte/_code_bundle/_packaging.py +1 -1
- flyte/_code_bundle/_utils.py +0 -16
- flyte/_code_bundle/bundle.py +43 -12
- flyte/_context.py +8 -2
- flyte/_deploy.py +56 -15
- flyte/_environment.py +45 -4
- flyte/_excepthook.py +37 -0
- flyte/_group.py +2 -1
- flyte/_image.py +8 -4
- flyte/_initialize.py +112 -254
- flyte/_interface.py +3 -3
- flyte/_internal/controllers/__init__.py +19 -6
- flyte/_internal/controllers/_local_controller.py +83 -8
- flyte/_internal/controllers/_trace.py +2 -1
- flyte/_internal/controllers/remote/__init__.py +27 -7
- flyte/_internal/controllers/remote/_action.py +7 -2
- flyte/_internal/controllers/remote/_client.py +5 -1
- flyte/_internal/controllers/remote/_controller.py +159 -26
- flyte/_internal/controllers/remote/_core.py +13 -5
- flyte/_internal/controllers/remote/_informer.py +4 -4
- flyte/_internal/controllers/remote/_service_protocol.py +6 -6
- flyte/_internal/imagebuild/docker_builder.py +12 -1
- flyte/_internal/imagebuild/image_builder.py +16 -11
- flyte/_internal/runtime/convert.py +164 -21
- flyte/_internal/runtime/entrypoints.py +1 -1
- flyte/_internal/runtime/io.py +3 -3
- flyte/_internal/runtime/task_serde.py +140 -20
- flyte/_internal/runtime/taskrunner.py +4 -3
- flyte/_internal/runtime/types_serde.py +1 -1
- flyte/_logging.py +12 -1
- flyte/_map.py +215 -0
- flyte/_pod.py +19 -0
- flyte/_protos/common/list_pb2.py +3 -3
- flyte/_protos/common/list_pb2.pyi +2 -0
- flyte/_protos/logs/dataplane/payload_pb2.py +28 -24
- flyte/_protos/logs/dataplane/payload_pb2.pyi +11 -2
- flyte/_protos/workflow/common_pb2.py +27 -0
- flyte/_protos/workflow/common_pb2.pyi +14 -0
- flyte/_protos/workflow/environment_pb2.py +29 -0
- flyte/_protos/workflow/environment_pb2.pyi +12 -0
- flyte/_protos/workflow/queue_service_pb2.py +40 -41
- flyte/_protos/workflow/queue_service_pb2.pyi +35 -30
- flyte/_protos/workflow/queue_service_pb2_grpc.py +15 -15
- flyte/_protos/workflow/run_definition_pb2.py +61 -61
- flyte/_protos/workflow/run_definition_pb2.pyi +8 -4
- flyte/_protos/workflow/run_service_pb2.py +20 -24
- flyte/_protos/workflow/run_service_pb2.pyi +2 -6
- flyte/_protos/workflow/state_service_pb2.py +36 -28
- flyte/_protos/workflow/state_service_pb2.pyi +19 -15
- flyte/_protos/workflow/state_service_pb2_grpc.py +28 -28
- flyte/_protos/workflow/task_definition_pb2.py +29 -22
- flyte/_protos/workflow/task_definition_pb2.pyi +21 -5
- flyte/_protos/workflow/task_service_pb2.py +27 -11
- flyte/_protos/workflow/task_service_pb2.pyi +29 -1
- flyte/_protos/workflow/task_service_pb2_grpc.py +34 -0
- flyte/_run.py +166 -95
- flyte/_task.py +110 -28
- flyte/_task_environment.py +55 -72
- flyte/_trace.py +6 -14
- flyte/_utils/__init__.py +6 -0
- flyte/_utils/async_cache.py +139 -0
- flyte/_utils/coro_management.py +0 -2
- flyte/_utils/helpers.py +45 -19
- flyte/_utils/org_discovery.py +57 -0
- flyte/_version.py +2 -2
- flyte/cli/__init__.py +3 -0
- flyte/cli/_abort.py +28 -0
- flyte/{_cli → cli}/_common.py +73 -23
- flyte/cli/_create.py +145 -0
- flyte/{_cli → cli}/_delete.py +4 -4
- flyte/{_cli → cli}/_deploy.py +26 -14
- flyte/cli/_gen.py +163 -0
- flyte/{_cli → cli}/_get.py +98 -23
- {union/_cli → flyte/cli}/_params.py +106 -147
- flyte/{_cli → cli}/_run.py +99 -20
- flyte/cli/main.py +166 -0
- flyte/config/__init__.py +3 -0
- flyte/config/_config.py +216 -0
- flyte/config/_internal.py +64 -0
- flyte/config/_reader.py +207 -0
- flyte/errors.py +29 -0
- flyte/extras/_container.py +33 -43
- flyte/io/__init__.py +17 -1
- flyte/io/_dir.py +2 -2
- flyte/io/_file.py +3 -4
- flyte/io/{structured_dataset → _structured_dataset}/basic_dfs.py +1 -1
- flyte/io/{structured_dataset → _structured_dataset}/structured_dataset.py +1 -1
- flyte/{_datastructures.py → models.py} +56 -7
- flyte/remote/__init__.py +2 -1
- flyte/remote/_client/_protocols.py +2 -0
- flyte/remote/_client/auth/_auth_utils.py +14 -0
- flyte/remote/_client/auth/_channel.py +34 -3
- flyte/remote/_client/auth/_token_client.py +3 -3
- flyte/remote/_client/controlplane.py +13 -13
- flyte/remote/_console.py +1 -1
- flyte/remote/_data.py +10 -6
- flyte/remote/_logs.py +89 -29
- flyte/remote/_project.py +8 -9
- flyte/remote/_run.py +228 -131
- flyte/remote/_secret.py +12 -12
- flyte/remote/_task.py +179 -15
- flyte/report/_report.py +4 -4
- flyte/storage/__init__.py +5 -0
- flyte/storage/_config.py +233 -0
- flyte/storage/_storage.py +23 -3
- flyte/syncify/__init__.py +56 -0
- flyte/syncify/_api.py +371 -0
- flyte/types/__init__.py +23 -0
- flyte/types/_interface.py +22 -7
- flyte/{io/pickle/transformer.py → types/_pickle.py} +2 -1
- flyte/types/_type_engine.py +95 -18
- flyte-0.2.0a0.dist-info/METADATA +249 -0
- flyte-0.2.0a0.dist-info/RECORD +218 -0
- {flyte-0.0.1b3.dist-info → flyte-0.2.0a0.dist-info}/entry_points.txt +1 -1
- flyte/_api_commons.py +0 -3
- flyte/_cli/__init__.py +0 -0
- flyte/_cli/_create.py +0 -42
- flyte/_cli/main.py +0 -72
- flyte/_internal/controllers/pbhash.py +0 -39
- flyte/io/_dataframe.py +0 -0
- flyte/io/pickle/__init__.py +0 -0
- flyte-0.0.1b3.dist-info/METADATA +0 -179
- flyte-0.0.1b3.dist-info/RECORD +0 -390
- union/__init__.py +0 -54
- union/_api_commons.py +0 -3
- union/_bin/__init__.py +0 -0
- union/_bin/runtime.py +0 -113
- union/_build.py +0 -25
- union/_cache/__init__.py +0 -12
- union/_cache/cache.py +0 -141
- union/_cache/defaults.py +0 -9
- union/_cache/policy_function_body.py +0 -42
- union/_cli/__init__.py +0 -0
- union/_cli/_common.py +0 -263
- union/_cli/_create.py +0 -40
- union/_cli/_delete.py +0 -23
- union/_cli/_deploy.py +0 -120
- union/_cli/_get.py +0 -162
- union/_cli/_run.py +0 -150
- union/_cli/main.py +0 -72
- union/_code_bundle/__init__.py +0 -8
- union/_code_bundle/_ignore.py +0 -113
- union/_code_bundle/_packaging.py +0 -187
- union/_code_bundle/_utils.py +0 -342
- union/_code_bundle/bundle.py +0 -176
- union/_context.py +0 -146
- union/_datastructures.py +0 -295
- union/_deploy.py +0 -185
- union/_doc.py +0 -29
- union/_docstring.py +0 -26
- union/_environment.py +0 -43
- union/_group.py +0 -31
- union/_hash.py +0 -23
- union/_image.py +0 -760
- union/_initialize.py +0 -585
- union/_interface.py +0 -84
- union/_internal/__init__.py +0 -3
- union/_internal/controllers/__init__.py +0 -77
- union/_internal/controllers/_local_controller.py +0 -77
- union/_internal/controllers/pbhash.py +0 -39
- union/_internal/controllers/remote/__init__.py +0 -40
- union/_internal/controllers/remote/_action.py +0 -131
- union/_internal/controllers/remote/_client.py +0 -43
- union/_internal/controllers/remote/_controller.py +0 -169
- union/_internal/controllers/remote/_core.py +0 -341
- union/_internal/controllers/remote/_informer.py +0 -260
- union/_internal/controllers/remote/_service_protocol.py +0 -44
- union/_internal/imagebuild/__init__.py +0 -11
- union/_internal/imagebuild/docker_builder.py +0 -416
- union/_internal/imagebuild/image_builder.py +0 -243
- union/_internal/imagebuild/remote_builder.py +0 -0
- union/_internal/resolvers/__init__.py +0 -0
- union/_internal/resolvers/_task_module.py +0 -31
- union/_internal/resolvers/common.py +0 -24
- union/_internal/resolvers/default.py +0 -27
- union/_internal/runtime/__init__.py +0 -0
- union/_internal/runtime/convert.py +0 -163
- union/_internal/runtime/entrypoints.py +0 -121
- union/_internal/runtime/io.py +0 -136
- union/_internal/runtime/resources_serde.py +0 -134
- union/_internal/runtime/task_serde.py +0 -202
- union/_internal/runtime/taskrunner.py +0 -179
- union/_internal/runtime/types_serde.py +0 -53
- union/_logging.py +0 -124
- union/_protos/__init__.py +0 -0
- union/_protos/common/authorization_pb2.py +0 -66
- union/_protos/common/authorization_pb2.pyi +0 -106
- union/_protos/common/identifier_pb2.py +0 -71
- union/_protos/common/identifier_pb2.pyi +0 -82
- union/_protos/common/identity_pb2.py +0 -48
- union/_protos/common/identity_pb2.pyi +0 -72
- union/_protos/common/identity_pb2_grpc.py +0 -4
- union/_protos/common/list_pb2.py +0 -36
- union/_protos/common/list_pb2.pyi +0 -69
- union/_protos/common/list_pb2_grpc.py +0 -4
- union/_protos/common/policy_pb2.py +0 -37
- union/_protos/common/policy_pb2.pyi +0 -27
- union/_protos/common/policy_pb2_grpc.py +0 -4
- union/_protos/common/role_pb2.py +0 -37
- union/_protos/common/role_pb2.pyi +0 -51
- union/_protos/common/role_pb2_grpc.py +0 -4
- union/_protos/common/runtime_version_pb2.py +0 -28
- union/_protos/common/runtime_version_pb2.pyi +0 -24
- union/_protos/common/runtime_version_pb2_grpc.py +0 -4
- union/_protos/logs/dataplane/payload_pb2.py +0 -96
- union/_protos/logs/dataplane/payload_pb2.pyi +0 -168
- union/_protos/logs/dataplane/payload_pb2_grpc.py +0 -4
- union/_protos/secret/definition_pb2.py +0 -49
- union/_protos/secret/definition_pb2.pyi +0 -93
- union/_protos/secret/definition_pb2_grpc.py +0 -4
- union/_protos/secret/payload_pb2.py +0 -62
- union/_protos/secret/payload_pb2.pyi +0 -94
- union/_protos/secret/payload_pb2_grpc.py +0 -4
- union/_protos/secret/secret_pb2.py +0 -38
- union/_protos/secret/secret_pb2.pyi +0 -6
- union/_protos/secret/secret_pb2_grpc.py +0 -198
- union/_protos/validate/validate/validate_pb2.py +0 -76
- union/_protos/workflow/node_execution_service_pb2.py +0 -26
- union/_protos/workflow/node_execution_service_pb2.pyi +0 -4
- union/_protos/workflow/node_execution_service_pb2_grpc.py +0 -32
- union/_protos/workflow/queue_service_pb2.py +0 -75
- union/_protos/workflow/queue_service_pb2.pyi +0 -103
- union/_protos/workflow/queue_service_pb2_grpc.py +0 -172
- union/_protos/workflow/run_definition_pb2.py +0 -100
- union/_protos/workflow/run_definition_pb2.pyi +0 -256
- union/_protos/workflow/run_definition_pb2_grpc.py +0 -4
- union/_protos/workflow/run_logs_service_pb2.py +0 -41
- union/_protos/workflow/run_logs_service_pb2.pyi +0 -28
- union/_protos/workflow/run_logs_service_pb2_grpc.py +0 -69
- union/_protos/workflow/run_service_pb2.py +0 -133
- union/_protos/workflow/run_service_pb2.pyi +0 -173
- union/_protos/workflow/run_service_pb2_grpc.py +0 -412
- union/_protos/workflow/state_service_pb2.py +0 -58
- union/_protos/workflow/state_service_pb2.pyi +0 -69
- union/_protos/workflow/state_service_pb2_grpc.py +0 -138
- union/_protos/workflow/task_definition_pb2.py +0 -72
- union/_protos/workflow/task_definition_pb2.pyi +0 -65
- union/_protos/workflow/task_definition_pb2_grpc.py +0 -4
- union/_protos/workflow/task_service_pb2.py +0 -44
- union/_protos/workflow/task_service_pb2.pyi +0 -31
- union/_protos/workflow/task_service_pb2_grpc.py +0 -104
- union/_resources.py +0 -226
- union/_retry.py +0 -32
- union/_reusable_environment.py +0 -25
- union/_run.py +0 -374
- union/_secret.py +0 -61
- union/_task.py +0 -354
- union/_task_environment.py +0 -186
- union/_timeout.py +0 -47
- union/_tools.py +0 -27
- union/_utils/__init__.py +0 -11
- union/_utils/asyn.py +0 -119
- union/_utils/file_handling.py +0 -71
- union/_utils/helpers.py +0 -46
- union/_utils/lazy_module.py +0 -54
- union/_utils/uv_script_parser.py +0 -49
- union/_version.py +0 -21
- union/connectors/__init__.py +0 -0
- union/errors.py +0 -128
- union/extras/__init__.py +0 -5
- union/extras/_container.py +0 -263
- union/io/__init__.py +0 -11
- union/io/_dataframe.py +0 -0
- union/io/_dir.py +0 -425
- union/io/_file.py +0 -418
- union/io/pickle/__init__.py +0 -0
- union/io/pickle/transformer.py +0 -117
- union/io/structured_dataset/__init__.py +0 -122
- union/io/structured_dataset/basic_dfs.py +0 -219
- union/io/structured_dataset/structured_dataset.py +0 -1057
- union/py.typed +0 -0
- union/remote/__init__.py +0 -23
- union/remote/_client/__init__.py +0 -0
- union/remote/_client/_protocols.py +0 -129
- union/remote/_client/auth/__init__.py +0 -12
- union/remote/_client/auth/_authenticators/__init__.py +0 -0
- union/remote/_client/auth/_authenticators/base.py +0 -391
- union/remote/_client/auth/_authenticators/client_credentials.py +0 -73
- union/remote/_client/auth/_authenticators/device_code.py +0 -120
- union/remote/_client/auth/_authenticators/external_command.py +0 -77
- union/remote/_client/auth/_authenticators/factory.py +0 -200
- union/remote/_client/auth/_authenticators/pkce.py +0 -515
- union/remote/_client/auth/_channel.py +0 -184
- union/remote/_client/auth/_client_config.py +0 -83
- union/remote/_client/auth/_default_html.py +0 -32
- union/remote/_client/auth/_grpc_utils/__init__.py +0 -0
- union/remote/_client/auth/_grpc_utils/auth_interceptor.py +0 -204
- union/remote/_client/auth/_grpc_utils/default_metadata_interceptor.py +0 -144
- union/remote/_client/auth/_keyring.py +0 -154
- union/remote/_client/auth/_token_client.py +0 -258
- union/remote/_client/auth/errors.py +0 -16
- union/remote/_client/controlplane.py +0 -86
- union/remote/_data.py +0 -149
- union/remote/_logs.py +0 -74
- union/remote/_project.py +0 -86
- union/remote/_run.py +0 -820
- union/remote/_secret.py +0 -132
- union/remote/_task.py +0 -193
- union/report/__init__.py +0 -3
- union/report/_report.py +0 -178
- union/report/_template.html +0 -124
- union/storage/__init__.py +0 -24
- union/storage/_remote_fs.py +0 -34
- union/storage/_storage.py +0 -247
- union/storage/_utils.py +0 -5
- union/types/__init__.py +0 -11
- union/types/_renderer.py +0 -162
- union/types/_string_literals.py +0 -120
- union/types/_type_engine.py +0 -2131
- union/types/_utils.py +0 -80
- /union/_protos/common/authorization_pb2_grpc.py → /flyte/_protos/workflow/common_pb2_grpc.py +0 -0
- /union/_protos/common/identifier_pb2_grpc.py → /flyte/_protos/workflow/environment_pb2_grpc.py +0 -0
- /flyte/io/{structured_dataset → _structured_dataset}/__init__.py +0 -0
- {flyte-0.0.1b3.dist-info → flyte-0.2.0a0.dist-info}/WHEEL +0 -0
- {flyte-0.0.1b3.dist-info → flyte-0.2.0a0.dist-info}/top_level.txt +0 -0
flyte/{_cli → cli}/_delete.py
RENAMED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import rich_click as click
|
|
2
2
|
|
|
3
|
-
import flyte.
|
|
3
|
+
import flyte.cli._common as common
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
@click.group(name="delete")
|
|
7
7
|
def delete():
|
|
8
8
|
"""
|
|
9
|
-
|
|
9
|
+
Remove resources from a Flyte deployment.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@
|
|
13
|
+
@delete.command(cls=common.CommandBase)
|
|
14
14
|
@click.argument("name", type=str, required=True)
|
|
15
15
|
@click.pass_obj
|
|
16
16
|
def secret(cfg: common.CLIConfig, name: str, project: str | None = None, domain: str | None = None):
|
|
17
17
|
"""
|
|
18
|
-
Delete a secret.
|
|
18
|
+
Delete a secret. The name of the secret is required.
|
|
19
19
|
"""
|
|
20
20
|
from flyte.remote import Secret
|
|
21
21
|
|
flyte/{_cli → cli}/_deploy.py
RENAMED
|
@@ -61,7 +61,7 @@ class DeployArguments:
|
|
|
61
61
|
@classmethod
|
|
62
62
|
def options(cls) -> List[click.Option]:
|
|
63
63
|
"""
|
|
64
|
-
Return the set of base parameters added to every
|
|
64
|
+
Return the set of base parameters added to every flyte run workflow subcommand.
|
|
65
65
|
"""
|
|
66
66
|
return [common.get_option_from_metadata(f.metadata) for f in fields(cls) if f.metadata]
|
|
67
67
|
|
|
@@ -74,42 +74,51 @@ class DeployEnvCommand(click.Command):
|
|
|
74
74
|
super().__init__(*args, **kwargs)
|
|
75
75
|
|
|
76
76
|
def invoke(self, ctx: Context):
|
|
77
|
-
|
|
77
|
+
from rich.console import Console
|
|
78
|
+
|
|
79
|
+
console = Console()
|
|
80
|
+
console.print(f"Deploying root - environment: {self.obj_name}")
|
|
78
81
|
obj: CLIConfig = ctx.obj
|
|
79
82
|
obj.init(self.deploy_args.project, self.deploy_args.domain)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
with console.status("Deploying...", spinner="dots"):
|
|
84
|
+
deployment = flyte.deploy(
|
|
85
|
+
self.obj,
|
|
86
|
+
dryrun=self.deploy_args.dry_run,
|
|
87
|
+
copy_style=self.deploy_args.copy_style,
|
|
88
|
+
version=self.deploy_args.version,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
console.print(common.get_table("Environments", deployment.env_repr()))
|
|
92
|
+
console.print(common.get_table("Tasks", deployment.task_repr()))
|
|
86
93
|
|
|
87
94
|
|
|
88
95
|
class EnvPerFileGroup(common.ObjectsPerFileGroup):
|
|
89
96
|
"""
|
|
90
|
-
Group that creates a command for each task in the current directory that is not __init__.py
|
|
97
|
+
Group that creates a command for each task in the current directory that is not `__init__.py`.
|
|
91
98
|
"""
|
|
92
99
|
|
|
93
100
|
def __init__(self, filename: Path, deploy_args: DeployArguments, *args, **kwargs):
|
|
101
|
+
args = (filename, *args)
|
|
94
102
|
super().__init__(*args, **kwargs)
|
|
95
103
|
self.deploy_args = deploy_args
|
|
96
104
|
|
|
97
105
|
def _filter_objects(self, module: ModuleType) -> Dict[str, Any]:
|
|
98
|
-
return {k: v for k, v in module.__dict__.items() if isinstance(v, flyte.
|
|
106
|
+
return {k: v for k, v in module.__dict__.items() if isinstance(v, flyte.Environment)}
|
|
99
107
|
|
|
100
108
|
def _get_command_for_obj(self, ctx: click.Context, obj_name: str, obj: Any) -> click.Command:
|
|
101
|
-
obj = cast(flyte.
|
|
109
|
+
obj = cast(flyte.Environment, obj)
|
|
102
110
|
return DeployEnvCommand(
|
|
111
|
+
name=obj_name,
|
|
103
112
|
obj_name=obj_name,
|
|
104
113
|
obj=obj,
|
|
105
|
-
help=obj.description,
|
|
114
|
+
help=f"{obj.name}" + (f": {obj.description}" if obj.description else ""),
|
|
106
115
|
deploy_args=self.deploy_args,
|
|
107
116
|
)
|
|
108
117
|
|
|
109
118
|
|
|
110
119
|
class EnvFiles(common.FileGroup):
|
|
111
120
|
"""
|
|
112
|
-
Group that creates a command for each file in the current directory that is not __init__.py
|
|
121
|
+
Group that creates a command for each file in the current directory that is not `__init__.py`.
|
|
113
122
|
"""
|
|
114
123
|
|
|
115
124
|
common_options_enabled = False
|
|
@@ -136,5 +145,8 @@ class EnvFiles(common.FileGroup):
|
|
|
136
145
|
|
|
137
146
|
deploy = EnvFiles(
|
|
138
147
|
name="deploy",
|
|
139
|
-
help="
|
|
148
|
+
help="""
|
|
149
|
+
Deploy one or more environments from a python file.
|
|
150
|
+
This command will create or update environments in the Flyte system.
|
|
151
|
+
""",
|
|
140
152
|
)
|
flyte/cli/_gen.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import textwrap
|
|
2
|
+
from os import getcwd
|
|
3
|
+
from typing import Generator, Tuple
|
|
4
|
+
|
|
5
|
+
import rich_click as click
|
|
6
|
+
|
|
7
|
+
import flyte.cli._common as common
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.group(name="gen")
|
|
11
|
+
def gen():
|
|
12
|
+
"""
|
|
13
|
+
Generate documentation.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@gen.command(cls=common.CommandBase)
|
|
18
|
+
@click.option("--type", "doc_type", type=str, required=True, help="Type of documentation (valid: markdown)")
|
|
19
|
+
@click.pass_obj
|
|
20
|
+
def docs(cfg: common.CLIConfig, doc_type: str, project: str | None = None, domain: str | None = None):
|
|
21
|
+
"""
|
|
22
|
+
Generate documentation.
|
|
23
|
+
"""
|
|
24
|
+
if doc_type == "markdown":
|
|
25
|
+
markdown(cfg)
|
|
26
|
+
else:
|
|
27
|
+
raise click.ClickException("Invalid documentation type: {}".format(doc_type))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def walk_commands(ctx: click.Context) -> Generator[Tuple[str, click.Command], None, None]:
|
|
31
|
+
"""
|
|
32
|
+
Recursively walk a Click command tree, starting from the given context.
|
|
33
|
+
|
|
34
|
+
Yields:
|
|
35
|
+
(full_command_path, command_object)
|
|
36
|
+
"""
|
|
37
|
+
command = ctx.command
|
|
38
|
+
|
|
39
|
+
if not isinstance(command, click.Group):
|
|
40
|
+
yield ctx.command_path, command
|
|
41
|
+
else:
|
|
42
|
+
for name in command.list_commands(ctx):
|
|
43
|
+
subcommand = command.get_command(ctx, name)
|
|
44
|
+
if subcommand is None:
|
|
45
|
+
continue
|
|
46
|
+
|
|
47
|
+
full_name = f"{ctx.command_path} {name}".strip()
|
|
48
|
+
yield full_name, subcommand
|
|
49
|
+
|
|
50
|
+
# Recurse if subcommand is a MultiCommand (i.e., has its own subcommands)
|
|
51
|
+
if isinstance(subcommand, click.Group):
|
|
52
|
+
sub_ctx = click.Context(subcommand, info_name=name, parent=ctx)
|
|
53
|
+
yield from walk_commands(sub_ctx)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def markdown(cfg: common.CLIConfig):
|
|
57
|
+
"""
|
|
58
|
+
Generate documentation in Markdown format
|
|
59
|
+
"""
|
|
60
|
+
ctx = cfg.ctx
|
|
61
|
+
|
|
62
|
+
output = []
|
|
63
|
+
output_verb_groups: dict[str, list[str]] = {}
|
|
64
|
+
output_noun_groups: dict[str, list[str]] = {}
|
|
65
|
+
|
|
66
|
+
commands = [*[("flyte", ctx.command)], *walk_commands(ctx)]
|
|
67
|
+
for cmd_path, cmd in commands:
|
|
68
|
+
output.append("")
|
|
69
|
+
|
|
70
|
+
cmd_path_parts = cmd_path.split(" ")
|
|
71
|
+
|
|
72
|
+
if len(cmd_path_parts) > 1:
|
|
73
|
+
if cmd_path_parts[1] not in output_verb_groups:
|
|
74
|
+
output_verb_groups[cmd_path_parts[1]] = []
|
|
75
|
+
if len(cmd_path_parts) > 2:
|
|
76
|
+
output_verb_groups[cmd_path_parts[1]].append(cmd_path_parts[2])
|
|
77
|
+
|
|
78
|
+
if len(cmd_path_parts) == 3:
|
|
79
|
+
if cmd_path_parts[2] not in output_noun_groups:
|
|
80
|
+
output_noun_groups[cmd_path_parts[2]] = []
|
|
81
|
+
output_noun_groups[cmd_path_parts[2]].append(cmd_path_parts[1])
|
|
82
|
+
|
|
83
|
+
output.append(f"{'#' * (len(cmd_path_parts) + 1)} {cmd_path}")
|
|
84
|
+
if cmd.help:
|
|
85
|
+
output.append("")
|
|
86
|
+
output.append(f"{dedent(cmd.help)}")
|
|
87
|
+
|
|
88
|
+
if not cmd.params:
|
|
89
|
+
continue
|
|
90
|
+
|
|
91
|
+
params = cmd.get_params(click.Context(cmd))
|
|
92
|
+
|
|
93
|
+
# Collect all data first to calculate column widths
|
|
94
|
+
table_data = []
|
|
95
|
+
for param in params:
|
|
96
|
+
if isinstance(param, click.Option):
|
|
97
|
+
# Format each option with backticks before joining
|
|
98
|
+
all_opts = param.opts + param.secondary_opts
|
|
99
|
+
if len(all_opts) == 1:
|
|
100
|
+
opts = f"`{all_opts[0]}`"
|
|
101
|
+
else:
|
|
102
|
+
opts = "".join(
|
|
103
|
+
[
|
|
104
|
+
"{{< multiline >}}",
|
|
105
|
+
"\n".join([f"`{opt}`" for opt in all_opts]),
|
|
106
|
+
"{{< /multiline >}}",
|
|
107
|
+
]
|
|
108
|
+
)
|
|
109
|
+
default_value = ""
|
|
110
|
+
if param.default is not None:
|
|
111
|
+
default_value = f"`{param.default}`"
|
|
112
|
+
default_value = default_value.replace(f"{getcwd()}/", "")
|
|
113
|
+
help_text = dedent(param.help) if param.help else ""
|
|
114
|
+
table_data.append([opts, f"`{param.type.name}`", default_value, help_text])
|
|
115
|
+
|
|
116
|
+
if not table_data:
|
|
117
|
+
continue
|
|
118
|
+
|
|
119
|
+
# Add table header with proper alignment
|
|
120
|
+
output.append("")
|
|
121
|
+
output.append("| Option | Type | Default | Description |")
|
|
122
|
+
output.append("|--------|------|---------|-------------|")
|
|
123
|
+
|
|
124
|
+
# Add table rows with proper alignment
|
|
125
|
+
for row in table_data:
|
|
126
|
+
output.append(f"| {row[0]} | {row[1]} | {row[2]} | {row[3]} |")
|
|
127
|
+
|
|
128
|
+
output_verb_index = []
|
|
129
|
+
|
|
130
|
+
if len(output_verb_groups) > 0:
|
|
131
|
+
output_verb_index.append("| Action | On |")
|
|
132
|
+
output_verb_index.append("| ------ | -- |")
|
|
133
|
+
for verb, nouns in output_verb_groups.items():
|
|
134
|
+
entries = [f"[`{noun}`](#flyte-{verb}-{noun})" for noun in nouns]
|
|
135
|
+
output_verb_index.append(f"| `{verb}` | {', '.join(entries)} |")
|
|
136
|
+
|
|
137
|
+
output_noun_index = []
|
|
138
|
+
|
|
139
|
+
if len(output_noun_groups) > 0:
|
|
140
|
+
output_noun_index.append("| Object | Action |")
|
|
141
|
+
output_noun_index.append("| ------ | -- |")
|
|
142
|
+
for obj, actions in output_noun_groups.items():
|
|
143
|
+
entries = [f"[`{action}`](#flyte-{action}-{obj})" for action in actions]
|
|
144
|
+
output_noun_index.append(f"| `{obj}` | {', '.join(entries)} |")
|
|
145
|
+
|
|
146
|
+
print()
|
|
147
|
+
print("{{< grid >}}")
|
|
148
|
+
print("{{< markdown >}}")
|
|
149
|
+
print("\n".join(output_noun_index))
|
|
150
|
+
print("{{< /markdown >}}")
|
|
151
|
+
print("{{< markdown >}}")
|
|
152
|
+
print("\n".join(output_verb_index))
|
|
153
|
+
print("{{< /markdown >}}")
|
|
154
|
+
print("{{< /grid >}}")
|
|
155
|
+
print()
|
|
156
|
+
print("\n".join(output))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def dedent(text: str) -> str:
|
|
160
|
+
"""
|
|
161
|
+
Remove leading whitespace from a string.
|
|
162
|
+
"""
|
|
163
|
+
return textwrap.dedent(text).strip("\n")
|
flyte/{_cli → cli}/_get.py
RENAMED
|
@@ -11,7 +11,23 @@ from . import _common as common
|
|
|
11
11
|
@click.group(name="get")
|
|
12
12
|
def get():
|
|
13
13
|
"""
|
|
14
|
-
|
|
14
|
+
Retrieve resources from a Flyte deployment.
|
|
15
|
+
|
|
16
|
+
You can get information about projects, runs, tasks, actions, secrets, logs and input/output values.
|
|
17
|
+
|
|
18
|
+
Each command supports optional parameters to filter or specify the resource you want to retrieve.
|
|
19
|
+
|
|
20
|
+
Using a `get` subcommand without any arguments will retrieve a list of available resources to get.
|
|
21
|
+
For example:
|
|
22
|
+
|
|
23
|
+
* `get project` (without specifying a project), will list all projects.
|
|
24
|
+
* `get project my_project` will return the details of the project named `my_project`.
|
|
25
|
+
|
|
26
|
+
In some cases, a partially specified command will act as a filter and return available further parameters.
|
|
27
|
+
For example:
|
|
28
|
+
|
|
29
|
+
* `get action my_run` will return all actions for the run named `my_run`.
|
|
30
|
+
* `get action my_run my_action` will return the details of the action named `my_action` for the run `my_run`.
|
|
15
31
|
"""
|
|
16
32
|
|
|
17
33
|
|
|
@@ -20,11 +36,10 @@ def get():
|
|
|
20
36
|
@click.pass_obj
|
|
21
37
|
def project(cfg: common.CLIConfig, name: str | None = None):
|
|
22
38
|
"""
|
|
23
|
-
Get
|
|
39
|
+
Get a list of all projects, or details of a specific project by name.
|
|
24
40
|
"""
|
|
25
41
|
from flyte.remote import Project
|
|
26
42
|
|
|
27
|
-
print(cfg)
|
|
28
43
|
cfg.init()
|
|
29
44
|
|
|
30
45
|
console = Console()
|
|
@@ -39,7 +54,11 @@ def project(cfg: common.CLIConfig, name: str | None = None):
|
|
|
39
54
|
@click.pass_obj
|
|
40
55
|
def run(cfg: common.CLIConfig, name: str | None = None, project: str | None = None, domain: str | None = None):
|
|
41
56
|
"""
|
|
42
|
-
Get
|
|
57
|
+
Get a list of all runs, or details of a specific run by name.
|
|
58
|
+
|
|
59
|
+
The run details will include information about the run, its status, but only the root action will be shown.
|
|
60
|
+
|
|
61
|
+
If you want to see the actions for a run, use `get action <run_name>`.
|
|
43
62
|
"""
|
|
44
63
|
from flyte.remote import Run, RunDetails
|
|
45
64
|
|
|
@@ -56,16 +75,20 @@ def run(cfg: common.CLIConfig, name: str | None = None, project: str | None = No
|
|
|
56
75
|
@get.command(cls=common.CommandBase)
|
|
57
76
|
@click.argument("name", type=str, required=False)
|
|
58
77
|
@click.argument("version", type=str, required=False)
|
|
78
|
+
@click.option("--limit", type=int, default=100, help="Limit the number of tasks to show.")
|
|
59
79
|
@click.pass_obj
|
|
60
80
|
def task(
|
|
61
81
|
cfg: common.CLIConfig,
|
|
62
82
|
name: str | None = None,
|
|
83
|
+
limit: int = 100,
|
|
63
84
|
version: str | None = None,
|
|
64
85
|
project: str | None = None,
|
|
65
86
|
domain: str | None = None,
|
|
66
87
|
):
|
|
67
88
|
"""
|
|
68
|
-
|
|
89
|
+
Retrieve a list of all tasks, or details of a specific task by name and version.
|
|
90
|
+
|
|
91
|
+
Currently, both `name` and `version` are required to get a specific task.
|
|
69
92
|
"""
|
|
70
93
|
from flyte.remote import Task
|
|
71
94
|
|
|
@@ -73,16 +96,16 @@ def task(
|
|
|
73
96
|
|
|
74
97
|
console = Console()
|
|
75
98
|
if name:
|
|
76
|
-
if
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
99
|
+
if version:
|
|
100
|
+
v = Task.get(name=name, version=version)
|
|
101
|
+
if v is None:
|
|
102
|
+
raise click.BadParameter(f"Task {name} not found.")
|
|
103
|
+
t = v.fetch()
|
|
104
|
+
console.print(pretty_repr(t))
|
|
105
|
+
else:
|
|
106
|
+
console.print(common.get_table("Tasks", Task.listall(by_task_name=name, limit=limit)))
|
|
83
107
|
else:
|
|
84
|
-
|
|
85
|
-
# console.print(common.get_table("Tasks", Task.listall()))
|
|
108
|
+
console.print(common.get_table("Tasks", Task.listall(limit=limit)))
|
|
86
109
|
|
|
87
110
|
|
|
88
111
|
@get.command(cls=common.CommandBase)
|
|
@@ -112,17 +135,20 @@ def action(
|
|
|
112
135
|
|
|
113
136
|
|
|
114
137
|
@get.command(cls=common.CommandBase)
|
|
115
|
-
@click.argument("run_name", type=str, required=
|
|
138
|
+
@click.argument("run_name", type=str, required=True)
|
|
116
139
|
@click.argument("action_name", type=str, required=False)
|
|
117
|
-
@click.option("--lines", "-l", type=int, default=30, help="Number of lines to show")
|
|
140
|
+
@click.option("--lines", "-l", type=int, default=30, help="Number of lines to show, only useful for --pretty")
|
|
118
141
|
@click.option("--show-ts", is_flag=True, help="Show timestamps")
|
|
119
142
|
@click.option(
|
|
120
|
-
"--
|
|
121
|
-
"-f",
|
|
143
|
+
"--pretty",
|
|
122
144
|
is_flag=True,
|
|
123
145
|
default=False,
|
|
124
|
-
help="
|
|
146
|
+
help="Show logs in an auto-scrolling box, where number of lines is limited to `--lines`",
|
|
125
147
|
)
|
|
148
|
+
@click.option(
|
|
149
|
+
"--attempt", "-a", type=int, default=None, help="Attempt number to show logs for, defaults to the latest attempt."
|
|
150
|
+
)
|
|
151
|
+
@click.option("--filter-system", is_flag=True, default=False, help="Filter all system logs from the output.")
|
|
126
152
|
@click.pass_obj
|
|
127
153
|
def logs(
|
|
128
154
|
cfg: common.CLIConfig,
|
|
@@ -132,17 +158,41 @@ def logs(
|
|
|
132
158
|
domain: str | None = None,
|
|
133
159
|
lines: int = 30,
|
|
134
160
|
show_ts: bool = False,
|
|
135
|
-
|
|
161
|
+
pretty: bool = True,
|
|
162
|
+
attempt: int | None = None,
|
|
163
|
+
filter_system: bool = False,
|
|
136
164
|
):
|
|
137
165
|
"""
|
|
138
|
-
|
|
166
|
+
Stream logs for the provided run or action.
|
|
167
|
+
If only the run is provided, only the logs for the parent action will be streamed:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
$ flyte get logs my_run
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If you want to see the logs for a specific action, you can provide the action name as well:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
$ flyte get logs my_run my_action
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
By default, logs will be shown in the raw format and will scroll the terminal.
|
|
180
|
+
If automatic scrolling and only tailing `--lines` number of lines is desired, use the `--pretty` flag:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
$ flyte get logs my_run my_action --pretty --lines 50
|
|
184
|
+
```
|
|
139
185
|
"""
|
|
140
186
|
import flyte.remote as remote
|
|
141
187
|
|
|
142
188
|
cfg.init(project=project, domain=domain)
|
|
143
189
|
|
|
144
190
|
async def _run_log_view(_obj):
|
|
145
|
-
task = asyncio.create_task(
|
|
191
|
+
task = asyncio.create_task(
|
|
192
|
+
_obj.show_logs(
|
|
193
|
+
max_lines=lines, show_ts=show_ts, raw=not pretty, attempt=attempt, filter_system=filter_system
|
|
194
|
+
)
|
|
195
|
+
)
|
|
146
196
|
try:
|
|
147
197
|
await task
|
|
148
198
|
except KeyboardInterrupt:
|
|
@@ -165,7 +215,7 @@ def secret(
|
|
|
165
215
|
domain: str | None = None,
|
|
166
216
|
):
|
|
167
217
|
"""
|
|
168
|
-
Get
|
|
218
|
+
Get a list of all secrets, or details of a specific secret by name.
|
|
169
219
|
"""
|
|
170
220
|
import flyte.remote as remote
|
|
171
221
|
|
|
@@ -195,6 +245,19 @@ def io(
|
|
|
195
245
|
):
|
|
196
246
|
"""
|
|
197
247
|
Get the inputs and outputs of a run or action.
|
|
248
|
+
If only the run name is provided, it will show the inputs and outputs of the root action of that run.
|
|
249
|
+
If an action name is provided, it will show the inputs and outputs for that action.
|
|
250
|
+
If `--inputs-only` or `--outputs-only` is specified, it will only show the inputs or outputs respectively.
|
|
251
|
+
|
|
252
|
+
Examples:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
$ flyte get io my_run
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
$ flyte get io my_run my_action
|
|
260
|
+
```
|
|
198
261
|
"""
|
|
199
262
|
if inputs_only and outputs_only:
|
|
200
263
|
raise click.BadParameter("Cannot use both --inputs-only and --outputs-only")
|
|
@@ -233,3 +296,15 @@ def io(
|
|
|
233
296
|
f"[green bold]Inputs[/green bold]\n{inputs}\n\n[blue bold]Outputs[/blue bold]\n{outputs}",
|
|
234
297
|
)
|
|
235
298
|
)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
@get.command(cls=click.RichCommand)
|
|
302
|
+
@click.pass_obj
|
|
303
|
+
def config(cfg: common.CLIConfig):
|
|
304
|
+
"""
|
|
305
|
+
Shows the automatically detected configuration to connect with the remote backend.
|
|
306
|
+
|
|
307
|
+
The configuration will include the endpoint, organization, and other settings that are used by the CLI.
|
|
308
|
+
"""
|
|
309
|
+
console = Console()
|
|
310
|
+
console.print(cfg)
|