flyte 0.2.0b5__py3-none-any.whl → 0.2.0b8__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 +2 -1
- flyte/_code_bundle/_utils.py +0 -16
- flyte/_code_bundle/bundle.py +1 -1
- flyte/_environment.py +42 -1
- flyte/_image.py +1 -2
- flyte/_initialize.py +52 -23
- flyte/_internal/controllers/__init__.py +2 -0
- flyte/_internal/controllers/_local_controller.py +3 -0
- flyte/_internal/controllers/remote/_controller.py +3 -0
- flyte/_internal/controllers/remote/_core.py +1 -1
- flyte/_internal/controllers/remote/_informer.py +3 -3
- flyte/_task.py +51 -12
- flyte/_task_environment.py +48 -66
- flyte/_utils/coro_management.py +0 -2
- flyte/_version.py +2 -2
- flyte/cli/_common.py +24 -15
- flyte/cli/_create.py +39 -8
- flyte/cli/_delete.py +2 -2
- flyte/cli/_deploy.py +4 -1
- flyte/cli/_gen.py +155 -0
- flyte/cli/_get.py +53 -7
- flyte/cli/_run.py +34 -8
- flyte/cli/main.py +69 -16
- flyte/config/__init__.py +2 -189
- flyte/config/_config.py +181 -172
- flyte/config/_internal.py +1 -1
- flyte/config/_reader.py +207 -0
- flyte/extras/_container.py +1 -1
- flyte/remote/_logs.py +9 -2
- flyte/remote/_run.py +26 -17
- flyte/syncify/__init__.py +51 -0
- flyte/syncify/_api.py +5 -6
- flyte-0.2.0b8.dist-info/METADATA +180 -0
- {flyte-0.2.0b5.dist-info → flyte-0.2.0b8.dist-info}/RECORD +37 -35
- flyte-0.2.0b5.dist-info/METADATA +0 -178
- {flyte-0.2.0b5.dist-info → flyte-0.2.0b8.dist-info}/WHEEL +0 -0
- {flyte-0.2.0b5.dist-info → flyte-0.2.0b8.dist-info}/entry_points.txt +0 -0
- {flyte-0.2.0b5.dist-info → flyte-0.2.0b8.dist-info}/top_level.txt +0 -0
flyte/cli/_common.py
CHANGED
|
@@ -19,11 +19,13 @@ from rich.table import Table
|
|
|
19
19
|
from rich.traceback import Traceback
|
|
20
20
|
|
|
21
21
|
import flyte.errors
|
|
22
|
+
from flyte._logging import logger
|
|
22
23
|
from flyte.config import Config
|
|
23
24
|
|
|
24
25
|
PREFERRED_BORDER_COLOR = "dim cyan"
|
|
25
26
|
PREFERRED_ACCENT_COLOR = "bold #FFD700"
|
|
26
27
|
HEADER_STYLE = f"{PREFERRED_ACCENT_COLOR} on black"
|
|
28
|
+
PANELS = False
|
|
27
29
|
|
|
28
30
|
PROJECT_OPTION = click.Option(
|
|
29
31
|
param_decls=["-p", "--project"],
|
|
@@ -71,11 +73,12 @@ class CLIConfig:
|
|
|
71
73
|
This is the global state for the CLI. It is manipulated by the main command.
|
|
72
74
|
"""
|
|
73
75
|
|
|
76
|
+
config: Config
|
|
77
|
+
ctx: click.Context
|
|
74
78
|
log_level: int | None = logging.ERROR
|
|
75
79
|
endpoint: str | None = None
|
|
76
80
|
insecure: bool = False
|
|
77
81
|
org_override: str | None = None
|
|
78
|
-
config: Config | None = None
|
|
79
82
|
|
|
80
83
|
def replace(self, **kwargs) -> CLIConfig:
|
|
81
84
|
"""
|
|
@@ -84,22 +87,26 @@ class CLIConfig:
|
|
|
84
87
|
return replace(self, **kwargs)
|
|
85
88
|
|
|
86
89
|
def init(self, project: str | None = None, domain: str | None = None):
|
|
87
|
-
import
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
project
|
|
92
|
-
domain
|
|
93
|
-
|
|
94
|
-
flyte.init(
|
|
95
|
-
endpoint=self.endpoint,
|
|
96
|
-
insecure=self.insecure,
|
|
97
|
-
org=self.org_override,
|
|
98
|
-
project=project,
|
|
99
|
-
domain=domain,
|
|
100
|
-
config=self.config,
|
|
90
|
+
from flyte.config._config import TaskConfig
|
|
91
|
+
|
|
92
|
+
task_cfg = TaskConfig(
|
|
93
|
+
org=self.org_override or self.config.task.org,
|
|
94
|
+
project=project or self.config.task.project,
|
|
95
|
+
domain=domain or self.config.task.domain,
|
|
101
96
|
)
|
|
102
97
|
|
|
98
|
+
kwargs: Dict[str, Any] = {}
|
|
99
|
+
if self.endpoint:
|
|
100
|
+
kwargs["endpoint"] = self.endpoint
|
|
101
|
+
if self.insecure is not None:
|
|
102
|
+
kwargs["insecure"] = self.insecure
|
|
103
|
+
platform_cfg = self.config.platform.replace(**kwargs)
|
|
104
|
+
|
|
105
|
+
updated_config = self.config.with_params(platform_cfg, task_cfg)
|
|
106
|
+
|
|
107
|
+
logger.debug(f"Initializing CLI with config: {updated_config}")
|
|
108
|
+
flyte.init_auto_from_config(updated_config)
|
|
109
|
+
|
|
103
110
|
|
|
104
111
|
class InvokeBaseMixin:
|
|
105
112
|
"""
|
|
@@ -316,6 +323,8 @@ def get_panel(title: str, renderable: Any) -> Panel:
|
|
|
316
323
|
"""
|
|
317
324
|
Get a panel from a list of values.
|
|
318
325
|
"""
|
|
326
|
+
if not PANELS:
|
|
327
|
+
return renderable
|
|
319
328
|
return Panel.fit(
|
|
320
329
|
renderable,
|
|
321
330
|
title=f"[{PREFERRED_ACCENT_COLOR}]{title}[/{PREFERRED_ACCENT_COLOR}]",
|
flyte/cli/_create.py
CHANGED
|
@@ -10,7 +10,7 @@ from flyte.remote._secret import SecretTypes
|
|
|
10
10
|
@click.group(name="create")
|
|
11
11
|
def create():
|
|
12
12
|
"""
|
|
13
|
-
|
|
13
|
+
The create subcommand allows you to create resources in a Flyte deployment.
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
|
|
@@ -32,7 +32,23 @@ def secret(
|
|
|
32
32
|
domain: str | None = None,
|
|
33
33
|
):
|
|
34
34
|
"""
|
|
35
|
-
Create a new secret.
|
|
35
|
+
Create a new secret, the name of the secret is required.
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
```bash
|
|
39
|
+
flyte create secret my_secret --value my_value
|
|
40
|
+
```
|
|
41
|
+
If `--from-file` is specified, the value will be read from the file instead of being provided directly.
|
|
42
|
+
Example:
|
|
43
|
+
```bash
|
|
44
|
+
flyte create secret my_secret --from-file /path/to/secret_file
|
|
45
|
+
```
|
|
46
|
+
Secret types can be used to create specific types of secrets. Some secrets are useful for image pull, while some
|
|
47
|
+
are `regular` / general purpose secrets.
|
|
48
|
+
Example:
|
|
49
|
+
```bash
|
|
50
|
+
flyte create secret my_secret --type image_pull
|
|
51
|
+
```
|
|
36
52
|
"""
|
|
37
53
|
from flyte.remote import Secret
|
|
38
54
|
|
|
@@ -55,9 +71,19 @@ def secret(
|
|
|
55
71
|
@click.option(
|
|
56
72
|
"-o",
|
|
57
73
|
"--output",
|
|
58
|
-
type=click.Path(),
|
|
59
|
-
default=Path.cwd(),
|
|
74
|
+
type=click.Path(exists=False, writable=True),
|
|
75
|
+
default=Path.cwd() / "config.yaml",
|
|
60
76
|
help="Path to the output dir where the config will be saved, defaults to current directory.",
|
|
77
|
+
show_default=True,
|
|
78
|
+
)
|
|
79
|
+
@click.option(
|
|
80
|
+
"--force",
|
|
81
|
+
is_flag=True,
|
|
82
|
+
default=False,
|
|
83
|
+
help="Force overwrite the config file if it already exists.",
|
|
84
|
+
show_default=True,
|
|
85
|
+
prompt="Are you sure you want to overwrite the config file?",
|
|
86
|
+
confirmation_prompt=True,
|
|
61
87
|
)
|
|
62
88
|
def config(
|
|
63
89
|
output: Path,
|
|
@@ -66,14 +92,19 @@ def config(
|
|
|
66
92
|
org: str | None = None,
|
|
67
93
|
project: str | None = None,
|
|
68
94
|
domain: str | None = None,
|
|
95
|
+
force: bool = False,
|
|
69
96
|
):
|
|
70
97
|
"""
|
|
71
|
-
|
|
98
|
+
This command creates a configuration file for Flyte CLI.
|
|
99
|
+
If the `--output` option is not specified, it will create a file named `config.yaml` in the current directory.
|
|
100
|
+
If the file already exists, it will raise an error unless the `--force` option is used.
|
|
72
101
|
"""
|
|
73
102
|
import yaml
|
|
74
103
|
|
|
75
|
-
|
|
76
|
-
|
|
104
|
+
if output.exists() and not force:
|
|
105
|
+
raise click.BadParameter(f"Output file {output} already exists. Use --force to overwrite.")
|
|
106
|
+
|
|
107
|
+
with open(output, "w") as f:
|
|
77
108
|
d = {
|
|
78
109
|
"admin": {
|
|
79
110
|
"endpoint": endpoint,
|
|
@@ -87,4 +118,4 @@ def config(
|
|
|
87
118
|
}
|
|
88
119
|
yaml.dump(d, f)
|
|
89
120
|
|
|
90
|
-
click.echo(f"Config file created at {
|
|
121
|
+
click.echo(f"Config file created at {output}")
|
flyte/cli/_delete.py
CHANGED
|
@@ -6,7 +6,7 @@ import flyte.cli._common as common
|
|
|
6
6
|
@click.group(name="delete")
|
|
7
7
|
def delete():
|
|
8
8
|
"""
|
|
9
|
-
|
|
9
|
+
The delete subcommand allows you to remove resources from a Flyte deployment.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ def delete():
|
|
|
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/_deploy.py
CHANGED
|
@@ -138,5 +138,8 @@ class EnvFiles(common.FileGroup):
|
|
|
138
138
|
|
|
139
139
|
deploy = EnvFiles(
|
|
140
140
|
name="deploy",
|
|
141
|
-
help="
|
|
141
|
+
help="""
|
|
142
|
+
Deploy one or more environments from a python file.
|
|
143
|
+
The deploy command will create or update environments in the Flyte system.
|
|
144
|
+
""",
|
|
142
145
|
)
|
flyte/cli/_gen.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from os import getcwd
|
|
2
|
+
from typing import Generator, Tuple
|
|
3
|
+
|
|
4
|
+
import rich_click as click
|
|
5
|
+
|
|
6
|
+
import flyte.cli._common as common
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.group(name="gen")
|
|
10
|
+
def gen():
|
|
11
|
+
"""
|
|
12
|
+
Generate documentation
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@gen.command(cls=common.CommandBase)
|
|
17
|
+
@click.option("--type", "doc_type", type=str, required=True, help="Type of documentation (valid: markdown)")
|
|
18
|
+
@click.pass_obj
|
|
19
|
+
def docs(cfg: common.CLIConfig, doc_type: str, project: str | None = None, domain: str | None = None):
|
|
20
|
+
"""
|
|
21
|
+
Generate documentation
|
|
22
|
+
"""
|
|
23
|
+
if doc_type == "markdown":
|
|
24
|
+
markdown(cfg)
|
|
25
|
+
else:
|
|
26
|
+
raise click.ClickException("Invalid documentation type: {}".format(doc_type))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def walk_commands(ctx: click.Context) -> Generator[Tuple[str, click.Command], None, None]:
|
|
30
|
+
"""
|
|
31
|
+
Recursively walk a Click command tree, starting from the given context.
|
|
32
|
+
|
|
33
|
+
Yields:
|
|
34
|
+
(full_command_path, command_object)
|
|
35
|
+
"""
|
|
36
|
+
command = ctx.command
|
|
37
|
+
|
|
38
|
+
if not isinstance(command, click.Group):
|
|
39
|
+
yield ctx.command_path, command
|
|
40
|
+
else:
|
|
41
|
+
for name in command.list_commands(ctx):
|
|
42
|
+
subcommand = command.get_command(ctx, name)
|
|
43
|
+
if subcommand is None:
|
|
44
|
+
continue
|
|
45
|
+
|
|
46
|
+
full_name = f"{ctx.command_path} {name}".strip()
|
|
47
|
+
yield full_name, subcommand
|
|
48
|
+
|
|
49
|
+
# Recurse if subcommand is a MultiCommand (i.e., has its own subcommands)
|
|
50
|
+
if isinstance(subcommand, click.Group):
|
|
51
|
+
sub_ctx = click.Context(subcommand, info_name=name, parent=ctx)
|
|
52
|
+
yield from walk_commands(sub_ctx)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def markdown(cfg: common.CLIConfig):
|
|
56
|
+
"""
|
|
57
|
+
Generate documentation in Markdown format
|
|
58
|
+
"""
|
|
59
|
+
ctx = cfg.ctx
|
|
60
|
+
|
|
61
|
+
output = []
|
|
62
|
+
output_verb_groups: dict[str, list[str]] = {}
|
|
63
|
+
output_noun_groups: dict[str, list[str]] = {}
|
|
64
|
+
|
|
65
|
+
commands = [*[("flyte", ctx.command)], *walk_commands(ctx)]
|
|
66
|
+
for cmd_path, cmd in commands:
|
|
67
|
+
output.append("")
|
|
68
|
+
|
|
69
|
+
cmd_path_parts = cmd_path.split(" ")
|
|
70
|
+
|
|
71
|
+
if len(cmd_path_parts) > 1:
|
|
72
|
+
if cmd_path_parts[1] not in output_verb_groups:
|
|
73
|
+
output_verb_groups[cmd_path_parts[1]] = []
|
|
74
|
+
if len(cmd_path_parts) > 2:
|
|
75
|
+
output_verb_groups[cmd_path_parts[1]].append(cmd_path_parts[2])
|
|
76
|
+
|
|
77
|
+
if len(cmd_path_parts) == 3:
|
|
78
|
+
if cmd_path_parts[2] not in output_noun_groups:
|
|
79
|
+
output_noun_groups[cmd_path_parts[2]] = []
|
|
80
|
+
output_noun_groups[cmd_path_parts[2]].append(cmd_path_parts[1])
|
|
81
|
+
|
|
82
|
+
output.append(f"{'#' * (len(cmd_path_parts) + 1)} {cmd_path}")
|
|
83
|
+
if cmd.help:
|
|
84
|
+
output.append("")
|
|
85
|
+
output.append(f"{cmd.help.strip()}")
|
|
86
|
+
|
|
87
|
+
if not cmd.params:
|
|
88
|
+
continue
|
|
89
|
+
|
|
90
|
+
params = cmd.get_params(click.Context(cmd))
|
|
91
|
+
|
|
92
|
+
# Collect all data first to calculate column widths
|
|
93
|
+
table_data = []
|
|
94
|
+
for param in params:
|
|
95
|
+
if isinstance(param, click.Option):
|
|
96
|
+
# Format each option with backticks before joining
|
|
97
|
+
all_opts = param.opts + param.secondary_opts
|
|
98
|
+
if len(all_opts) == 1:
|
|
99
|
+
opts = f"`{all_opts[0]}`"
|
|
100
|
+
else:
|
|
101
|
+
opts = "".join(
|
|
102
|
+
[
|
|
103
|
+
"{{< multiline >}}",
|
|
104
|
+
"\n".join([f"`{opt}`" for opt in all_opts]),
|
|
105
|
+
"{{< /multiline >}}",
|
|
106
|
+
]
|
|
107
|
+
)
|
|
108
|
+
default_value = ""
|
|
109
|
+
if param.default is not None:
|
|
110
|
+
default_value = f"`{param.default}`"
|
|
111
|
+
default_value = default_value.replace(f"{getcwd()}/", "")
|
|
112
|
+
help_text = param.help.strip() if param.help else ""
|
|
113
|
+
table_data.append([opts, f"`{param.type.name}`", default_value, help_text])
|
|
114
|
+
|
|
115
|
+
if not table_data:
|
|
116
|
+
continue
|
|
117
|
+
|
|
118
|
+
# Add table header with proper alignment
|
|
119
|
+
output.append("")
|
|
120
|
+
output.append("| Option | Type | Default | Description |")
|
|
121
|
+
output.append("|--------|------|---------|-------------|")
|
|
122
|
+
|
|
123
|
+
# Add table rows with proper alignment
|
|
124
|
+
for row in table_data:
|
|
125
|
+
output.append(f"| {row[0]} | {row[1]} | {row[2]} | {row[3]} |")
|
|
126
|
+
|
|
127
|
+
output_verb_index = []
|
|
128
|
+
|
|
129
|
+
if len(output_verb_groups) > 0:
|
|
130
|
+
output_verb_index.append("| Action | On |")
|
|
131
|
+
output_verb_index.append("| ------ | -- |")
|
|
132
|
+
for verb, nouns in output_verb_groups.items():
|
|
133
|
+
entries = [f"[`{noun}`](#flyte-{verb}-{noun})" for noun in nouns]
|
|
134
|
+
output_verb_index.append(f"| `{verb}` | {', '.join(entries)} |")
|
|
135
|
+
|
|
136
|
+
output_noun_index = []
|
|
137
|
+
|
|
138
|
+
if len(output_noun_groups) > 0:
|
|
139
|
+
output_noun_index.append("| Object | Action |")
|
|
140
|
+
output_noun_index.append("| ------ | -- |")
|
|
141
|
+
for obj, actions in output_noun_groups.items():
|
|
142
|
+
entries = [f"[`{action}`](#flyte-{action}-{obj})" for action in actions]
|
|
143
|
+
output_noun_index.append(f"| `{obj}` | {', '.join(entries)} |")
|
|
144
|
+
|
|
145
|
+
print()
|
|
146
|
+
print("{{< grid >}}")
|
|
147
|
+
print("{{< markdown >}}")
|
|
148
|
+
print("\n".join(output_noun_index))
|
|
149
|
+
print("{{< /markdown >}}")
|
|
150
|
+
print("{{< markdown >}}")
|
|
151
|
+
print("\n".join(output_verb_index))
|
|
152
|
+
print("{{< /markdown >}}")
|
|
153
|
+
print("{{< /grid >}}")
|
|
154
|
+
print()
|
|
155
|
+
print("\n".join(output))
|
flyte/cli/_get.py
CHANGED
|
@@ -11,7 +11,16 @@ from . import _common as common
|
|
|
11
11
|
@click.group(name="get")
|
|
12
12
|
def get():
|
|
13
13
|
"""
|
|
14
|
-
|
|
14
|
+
The `get` subcommand allows you to retrieve various resources from a Flyte deployment.
|
|
15
|
+
|
|
16
|
+
You can get information about projects, runs, tasks, actions, secrets, and more.
|
|
17
|
+
Each command supports optional parameters to filter or specify the resource you want to retrieve.
|
|
18
|
+
|
|
19
|
+
Every `get` subcommand for example ``get project` without any arguments will list all projects.
|
|
20
|
+
`get project my_project` will return the details of the project named `my_project`.
|
|
21
|
+
|
|
22
|
+
In some cases `get action my_run` will return all actions for the run named `my_run` and
|
|
23
|
+
`get action my_run my_action` will return the details of the action named `my_action` for the run `my_run`.
|
|
15
24
|
"""
|
|
16
25
|
|
|
17
26
|
|
|
@@ -20,7 +29,7 @@ def get():
|
|
|
20
29
|
@click.pass_obj
|
|
21
30
|
def project(cfg: common.CLIConfig, name: str | None = None):
|
|
22
31
|
"""
|
|
23
|
-
|
|
32
|
+
Retrieve a list of all projects or details of a specific project by name.
|
|
24
33
|
"""
|
|
25
34
|
from flyte.remote import Project
|
|
26
35
|
|
|
@@ -39,7 +48,11 @@ def project(cfg: common.CLIConfig, name: str | None = None):
|
|
|
39
48
|
@click.pass_obj
|
|
40
49
|
def run(cfg: common.CLIConfig, name: str | None = None, project: str | None = None, domain: str | None = None):
|
|
41
50
|
"""
|
|
42
|
-
Get
|
|
51
|
+
Get list of all runs or details of a specific run by name.
|
|
52
|
+
|
|
53
|
+
The run details will include information about the run, its status, but only the root action will be shown.
|
|
54
|
+
|
|
55
|
+
If you want to see the actions for a run, use `get action <run_name>`.
|
|
43
56
|
"""
|
|
44
57
|
from flyte.remote import Run, RunDetails
|
|
45
58
|
|
|
@@ -65,7 +78,9 @@ def task(
|
|
|
65
78
|
domain: str | None = None,
|
|
66
79
|
):
|
|
67
80
|
"""
|
|
68
|
-
|
|
81
|
+
Retrieve a list of all tasks or details of a specific task by name and version.
|
|
82
|
+
|
|
83
|
+
Currently name+version are required to get a specific task.
|
|
69
84
|
"""
|
|
70
85
|
from flyte.remote import Task
|
|
71
86
|
|
|
@@ -140,8 +155,24 @@ def logs(
|
|
|
140
155
|
filter_system: bool = False,
|
|
141
156
|
):
|
|
142
157
|
"""
|
|
143
|
-
Stream logs for the provided run or action.
|
|
144
|
-
streamed.
|
|
158
|
+
Stream logs for the provided run or action.
|
|
159
|
+
If only the run is provided, only the logs for the parent action will be streamed.
|
|
160
|
+
|
|
161
|
+
Example:
|
|
162
|
+
```bash
|
|
163
|
+
flyte get logs my_run
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
But, if you want to see the logs for a specific action, you can provide the action name as well:
|
|
167
|
+
```bash
|
|
168
|
+
flyte get logs my_run my_action
|
|
169
|
+
```
|
|
170
|
+
By default logs will be shown in the raw format, will scroll on the terminal. If automatic scrolling and only
|
|
171
|
+
tailing --lines lines is desired, use the `--pretty` flag:
|
|
172
|
+
```bash
|
|
173
|
+
flyte get logs my_run my_action --pretty --lines 50
|
|
174
|
+
```
|
|
175
|
+
|
|
145
176
|
"""
|
|
146
177
|
import flyte.remote as remote
|
|
147
178
|
|
|
@@ -175,7 +206,7 @@ def secret(
|
|
|
175
206
|
domain: str | None = None,
|
|
176
207
|
):
|
|
177
208
|
"""
|
|
178
|
-
|
|
209
|
+
Retrieve a list of all secrets or details of a specific secret by name.
|
|
179
210
|
"""
|
|
180
211
|
import flyte.remote as remote
|
|
181
212
|
|
|
@@ -205,6 +236,19 @@ def io(
|
|
|
205
236
|
):
|
|
206
237
|
"""
|
|
207
238
|
Get the inputs and outputs of a run or action.
|
|
239
|
+
if only the run name is provided, it will show the inputs and outputs of the root action of that run.
|
|
240
|
+
If an action name is provided, it will show the inputs and outputs for that action.
|
|
241
|
+
|
|
242
|
+
If `--inputs-only` or `--outputs-only` is specified, it will only show the inputs or outputs respectively.
|
|
243
|
+
|
|
244
|
+
Example:
|
|
245
|
+
```bash
|
|
246
|
+
flyte get io my_run
|
|
247
|
+
```
|
|
248
|
+
or
|
|
249
|
+
```bash
|
|
250
|
+
flyte get io my_run my_action
|
|
251
|
+
```
|
|
208
252
|
"""
|
|
209
253
|
if inputs_only and outputs_only:
|
|
210
254
|
raise click.BadParameter("Cannot use both --inputs-only and --outputs-only")
|
|
@@ -250,6 +294,8 @@ def io(
|
|
|
250
294
|
def config(cfg: common.CLIConfig):
|
|
251
295
|
"""
|
|
252
296
|
Shows the automatically detected configuration to connect with remote Flyte services.
|
|
297
|
+
|
|
298
|
+
The configuration will include the endpoint, organization, and other settings that are used by the CLI.
|
|
253
299
|
"""
|
|
254
300
|
console = Console()
|
|
255
301
|
console.print(cfg)
|
flyte/cli/_run.py
CHANGED
|
@@ -12,8 +12,6 @@ from click import Context, Parameter
|
|
|
12
12
|
from rich.console import Console
|
|
13
13
|
from typing_extensions import get_args
|
|
14
14
|
|
|
15
|
-
import flyte
|
|
16
|
-
|
|
17
15
|
from .._code_bundle._utils import CopyFiles
|
|
18
16
|
from .._task import TaskTemplate
|
|
19
17
|
from ..remote import Run
|
|
@@ -95,11 +93,19 @@ class RunTaskCommand(click.Command):
|
|
|
95
93
|
super().__init__(obj_name, *args, **kwargs)
|
|
96
94
|
|
|
97
95
|
def invoke(self, ctx: Context):
|
|
98
|
-
obj: CLIConfig = ctx.obj
|
|
99
|
-
|
|
96
|
+
obj: CLIConfig = ctx.obj
|
|
97
|
+
if obj is None:
|
|
98
|
+
import flyte.config
|
|
99
|
+
|
|
100
|
+
obj = CLIConfig(flyte.config.auto())
|
|
101
|
+
|
|
102
|
+
if not self.run_args.local:
|
|
103
|
+
assert obj.endpoint, "CLI Config should have an endpoint"
|
|
100
104
|
obj.init(self.run_args.project, self.run_args.domain)
|
|
101
105
|
|
|
102
106
|
async def _run():
|
|
107
|
+
import flyte
|
|
108
|
+
|
|
103
109
|
r = flyte.with_runcontext(
|
|
104
110
|
copy_style=self.run_args.copy_style,
|
|
105
111
|
version=self.run_args.copy_style,
|
|
@@ -112,8 +118,8 @@ class RunTaskCommand(click.Command):
|
|
|
112
118
|
common.get_panel(
|
|
113
119
|
"Run",
|
|
114
120
|
f"[green bold]Created Run: {r.name} [/green bold] "
|
|
115
|
-
f"(Project: {r.action.action_id.run.project}, Domain: {r.action.action_id.run.domain})\n
|
|
116
|
-
f"[blue bold]{r.url}[/blue bold]",
|
|
121
|
+
f"(Project: {r.action.action_id.run.project}, Domain: {r.action.action_id.run.domain})\n"
|
|
122
|
+
f"➡️ [blue bold]{r.url}[/blue bold]",
|
|
117
123
|
)
|
|
118
124
|
)
|
|
119
125
|
if self.run_args.follow:
|
|
@@ -198,11 +204,31 @@ class TaskFiles(common.FileGroup):
|
|
|
198
204
|
filename=Path(filename),
|
|
199
205
|
run_args=run_args,
|
|
200
206
|
name=filename,
|
|
201
|
-
help=f"Run, functions decorated `env.task` {filename}",
|
|
207
|
+
help=f"Run, functions decorated with `env.task` in {filename}",
|
|
202
208
|
)
|
|
203
209
|
|
|
204
210
|
|
|
205
211
|
run = TaskFiles(
|
|
206
212
|
name="run",
|
|
207
|
-
help="
|
|
213
|
+
help="""
|
|
214
|
+
Run a task from a python file.
|
|
215
|
+
|
|
216
|
+
Example usage:
|
|
217
|
+
```bash
|
|
218
|
+
flyte run --name examples/basics/hello.py my_task --arg1 value1 --arg2 value2
|
|
219
|
+
```
|
|
220
|
+
Note: all arguments for the run command are provided right after the `run` command and before the file name.
|
|
221
|
+
|
|
222
|
+
You can also specify the project and domain using the `--project` and `--domain` options, respectively. These
|
|
223
|
+
options can be set in the config file or passed as command line arguments.
|
|
224
|
+
|
|
225
|
+
Note: The arguments for the task are provided after the task name and can be retrieved using `--help`
|
|
226
|
+
Example:
|
|
227
|
+
```bash
|
|
228
|
+
flyte run --name examples/basics/hello.py my_task --help
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
To run a task locally, use the `--local` flag. This will run the task in the local environment instead of the remote
|
|
232
|
+
Flyte environment.
|
|
233
|
+
""",
|
|
208
234
|
)
|
flyte/cli/main.py
CHANGED
|
@@ -2,14 +2,36 @@ import rich_click as click
|
|
|
2
2
|
|
|
3
3
|
from flyte._logging import initialize_logger, logger
|
|
4
4
|
|
|
5
|
-
from ..config import Config
|
|
6
5
|
from ._abort import abort
|
|
7
6
|
from ._common import CLIConfig
|
|
8
7
|
from ._create import create
|
|
9
8
|
from ._deploy import deploy
|
|
9
|
+
from ._gen import gen
|
|
10
10
|
from ._get import get
|
|
11
11
|
from ._run import run
|
|
12
12
|
|
|
13
|
+
click.rich_click.COMMAND_GROUPS = {
|
|
14
|
+
"flyte": [
|
|
15
|
+
{
|
|
16
|
+
"name": "Running Workflows",
|
|
17
|
+
"commands": ["run", "abort"],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "Management",
|
|
21
|
+
"commands": ["create", "deploy", "get"],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Documentation Generation",
|
|
25
|
+
"commands": ["gen"],
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
help_config = click.RichHelpConfiguration(
|
|
31
|
+
use_markdown=True,
|
|
32
|
+
use_markdown_emoji=True,
|
|
33
|
+
)
|
|
34
|
+
|
|
13
35
|
|
|
14
36
|
def _verbosity_to_loglevel(verbosity: int) -> int | None:
|
|
15
37
|
"""
|
|
@@ -39,18 +61,19 @@ def _verbosity_to_loglevel(verbosity: int) -> int | None:
|
|
|
39
61
|
help="The endpoint to connect to, this will override any config and simply used pkce to connect.",
|
|
40
62
|
)
|
|
41
63
|
@click.option(
|
|
42
|
-
"--insecure",
|
|
64
|
+
"--insecure/--secure",
|
|
43
65
|
is_flag=True,
|
|
44
66
|
required=False,
|
|
45
|
-
help="insecure",
|
|
67
|
+
help="Use insecure connection to the endpoint. If secure is specified, the CLI will use TLS.",
|
|
46
68
|
type=bool,
|
|
47
69
|
default=None,
|
|
70
|
+
show_default=True,
|
|
48
71
|
)
|
|
49
72
|
@click.option(
|
|
50
73
|
"-v",
|
|
51
74
|
"--verbose",
|
|
52
75
|
required=False,
|
|
53
|
-
help="Show verbose messages and exception traces",
|
|
76
|
+
help="Show verbose messages and exception traces, multiple times increases verbosity (e.g., -vvv).",
|
|
54
77
|
count=True,
|
|
55
78
|
default=0,
|
|
56
79
|
type=int,
|
|
@@ -70,6 +93,7 @@ def _verbosity_to_loglevel(verbosity: int) -> int | None:
|
|
|
70
93
|
help="Path to config file (YAML format) to use for the CLI. If not specified,"
|
|
71
94
|
" the default config file will be used.",
|
|
72
95
|
)
|
|
96
|
+
@click.rich_config(help_config=help_config)
|
|
73
97
|
@click.pass_context
|
|
74
98
|
def main(
|
|
75
99
|
ctx: click.Context,
|
|
@@ -80,28 +104,56 @@ def main(
|
|
|
80
104
|
config_file: str | None,
|
|
81
105
|
):
|
|
82
106
|
"""
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
( __)( ) ( \\/ )(_ _)( __) / )( \\(___ \\ / \
|
|
86
|
-
) _) / (_/\\ ) / )( ) _) \\ \\/ / / __/ _( 0 )
|
|
87
|
-
(__) \\____/(__/ (__) (____) \\__/ (____)(_)\\__/
|
|
107
|
+
### Flyte entrypoint for the CLI
|
|
108
|
+
The Flyte CLI is a command line interface for interacting with Flyte.
|
|
88
109
|
|
|
89
110
|
The flyte cli follows a simple verb based structure, where the top-level commands are verbs that describe the action
|
|
90
|
-
to be taken, and the subcommands are nouns that describe the object of the action.
|
|
111
|
+
to be taken, and the subcommands are nouns that describe the object of the action.
|
|
112
|
+
|
|
113
|
+
The root command can be used to configure the CLI for most commands, such as setting the endpoint,
|
|
114
|
+
organization, and verbosity level.
|
|
115
|
+
|
|
116
|
+
Example: Set endpoint and organization
|
|
117
|
+
```bash
|
|
118
|
+
flyte --endpoint <endpoint> --org <org> get project <project_name>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Example: Increase verbosity level (This is useful for debugging, this will show more logs and exception traces)
|
|
122
|
+
```bash
|
|
123
|
+
flyte -vvv get logs <run-name>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Example: Override the default config file
|
|
127
|
+
```bash
|
|
128
|
+
flyte --config /path/to/config.yaml run ...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
👉 [Documentation](https://www.union.ai/docs/flyte/user-guide/) \n
|
|
132
|
+
👉 [GitHub](https://github.com/flyteorg/flyte) - Please leave a ⭐. \n
|
|
133
|
+
👉 [Slack](https://slack.flyte.org) - Join the community and ask questions.
|
|
134
|
+
👉 [Issues](https://github.com/flyteorg/flyte/issues)
|
|
135
|
+
|
|
91
136
|
"""
|
|
137
|
+
import flyte.config as config
|
|
138
|
+
|
|
92
139
|
log_level = _verbosity_to_loglevel(verbose)
|
|
93
140
|
if log_level is not None:
|
|
94
141
|
initialize_logger(log_level)
|
|
95
142
|
|
|
96
|
-
|
|
97
|
-
logger.debug(f"Using config file discovered at location {
|
|
143
|
+
cfg = config.auto(config_file=config_file)
|
|
144
|
+
logger.debug(f"Using config file discovered at location {cfg.source}")
|
|
145
|
+
|
|
146
|
+
final_insecure = cfg.platform.insecure
|
|
147
|
+
if insecure is not None:
|
|
148
|
+
final_insecure = insecure
|
|
98
149
|
|
|
99
150
|
ctx.obj = CLIConfig(
|
|
100
151
|
log_level=log_level,
|
|
101
|
-
endpoint=endpoint or
|
|
102
|
-
insecure=
|
|
103
|
-
org_override=org or
|
|
104
|
-
config=
|
|
152
|
+
endpoint=endpoint or cfg.platform.endpoint,
|
|
153
|
+
insecure=final_insecure,
|
|
154
|
+
org_override=org or cfg.task.org,
|
|
155
|
+
config=cfg,
|
|
156
|
+
ctx=ctx,
|
|
105
157
|
)
|
|
106
158
|
logger.debug(f"Final materialized Cli config: {ctx.obj}")
|
|
107
159
|
|
|
@@ -111,3 +163,4 @@ main.add_command(deploy)
|
|
|
111
163
|
main.add_command(get) # type: ignore
|
|
112
164
|
main.add_command(create) # type: ignore
|
|
113
165
|
main.add_command(abort) # type: ignore
|
|
166
|
+
main.add_command(gen) # type: ignore
|