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.

Files changed (319) hide show
  1. flyte/__init__.py +20 -4
  2. flyte/_bin/runtime.py +33 -7
  3. flyte/_build.py +3 -2
  4. flyte/_cache/cache.py +1 -2
  5. flyte/_code_bundle/_packaging.py +1 -1
  6. flyte/_code_bundle/_utils.py +0 -16
  7. flyte/_code_bundle/bundle.py +43 -12
  8. flyte/_context.py +8 -2
  9. flyte/_deploy.py +56 -15
  10. flyte/_environment.py +45 -4
  11. flyte/_excepthook.py +37 -0
  12. flyte/_group.py +2 -1
  13. flyte/_image.py +8 -4
  14. flyte/_initialize.py +112 -254
  15. flyte/_interface.py +3 -3
  16. flyte/_internal/controllers/__init__.py +19 -6
  17. flyte/_internal/controllers/_local_controller.py +83 -8
  18. flyte/_internal/controllers/_trace.py +2 -1
  19. flyte/_internal/controllers/remote/__init__.py +27 -7
  20. flyte/_internal/controllers/remote/_action.py +7 -2
  21. flyte/_internal/controllers/remote/_client.py +5 -1
  22. flyte/_internal/controllers/remote/_controller.py +159 -26
  23. flyte/_internal/controllers/remote/_core.py +13 -5
  24. flyte/_internal/controllers/remote/_informer.py +4 -4
  25. flyte/_internal/controllers/remote/_service_protocol.py +6 -6
  26. flyte/_internal/imagebuild/docker_builder.py +12 -1
  27. flyte/_internal/imagebuild/image_builder.py +16 -11
  28. flyte/_internal/runtime/convert.py +164 -21
  29. flyte/_internal/runtime/entrypoints.py +1 -1
  30. flyte/_internal/runtime/io.py +3 -3
  31. flyte/_internal/runtime/task_serde.py +140 -20
  32. flyte/_internal/runtime/taskrunner.py +4 -3
  33. flyte/_internal/runtime/types_serde.py +1 -1
  34. flyte/_logging.py +12 -1
  35. flyte/_map.py +215 -0
  36. flyte/_pod.py +19 -0
  37. flyte/_protos/common/list_pb2.py +3 -3
  38. flyte/_protos/common/list_pb2.pyi +2 -0
  39. flyte/_protos/logs/dataplane/payload_pb2.py +28 -24
  40. flyte/_protos/logs/dataplane/payload_pb2.pyi +11 -2
  41. flyte/_protos/workflow/common_pb2.py +27 -0
  42. flyte/_protos/workflow/common_pb2.pyi +14 -0
  43. flyte/_protos/workflow/environment_pb2.py +29 -0
  44. flyte/_protos/workflow/environment_pb2.pyi +12 -0
  45. flyte/_protos/workflow/queue_service_pb2.py +40 -41
  46. flyte/_protos/workflow/queue_service_pb2.pyi +35 -30
  47. flyte/_protos/workflow/queue_service_pb2_grpc.py +15 -15
  48. flyte/_protos/workflow/run_definition_pb2.py +61 -61
  49. flyte/_protos/workflow/run_definition_pb2.pyi +8 -4
  50. flyte/_protos/workflow/run_service_pb2.py +20 -24
  51. flyte/_protos/workflow/run_service_pb2.pyi +2 -6
  52. flyte/_protos/workflow/state_service_pb2.py +36 -28
  53. flyte/_protos/workflow/state_service_pb2.pyi +19 -15
  54. flyte/_protos/workflow/state_service_pb2_grpc.py +28 -28
  55. flyte/_protos/workflow/task_definition_pb2.py +29 -22
  56. flyte/_protos/workflow/task_definition_pb2.pyi +21 -5
  57. flyte/_protos/workflow/task_service_pb2.py +27 -11
  58. flyte/_protos/workflow/task_service_pb2.pyi +29 -1
  59. flyte/_protos/workflow/task_service_pb2_grpc.py +34 -0
  60. flyte/_run.py +166 -95
  61. flyte/_task.py +110 -28
  62. flyte/_task_environment.py +55 -72
  63. flyte/_trace.py +6 -14
  64. flyte/_utils/__init__.py +6 -0
  65. flyte/_utils/async_cache.py +139 -0
  66. flyte/_utils/coro_management.py +0 -2
  67. flyte/_utils/helpers.py +45 -19
  68. flyte/_utils/org_discovery.py +57 -0
  69. flyte/_version.py +2 -2
  70. flyte/cli/__init__.py +3 -0
  71. flyte/cli/_abort.py +28 -0
  72. flyte/{_cli → cli}/_common.py +73 -23
  73. flyte/cli/_create.py +145 -0
  74. flyte/{_cli → cli}/_delete.py +4 -4
  75. flyte/{_cli → cli}/_deploy.py +26 -14
  76. flyte/cli/_gen.py +163 -0
  77. flyte/{_cli → cli}/_get.py +98 -23
  78. {union/_cli → flyte/cli}/_params.py +106 -147
  79. flyte/{_cli → cli}/_run.py +99 -20
  80. flyte/cli/main.py +166 -0
  81. flyte/config/__init__.py +3 -0
  82. flyte/config/_config.py +216 -0
  83. flyte/config/_internal.py +64 -0
  84. flyte/config/_reader.py +207 -0
  85. flyte/errors.py +29 -0
  86. flyte/extras/_container.py +33 -43
  87. flyte/io/__init__.py +17 -1
  88. flyte/io/_dir.py +2 -2
  89. flyte/io/_file.py +3 -4
  90. flyte/io/{structured_dataset → _structured_dataset}/basic_dfs.py +1 -1
  91. flyte/io/{structured_dataset → _structured_dataset}/structured_dataset.py +1 -1
  92. flyte/{_datastructures.py → models.py} +56 -7
  93. flyte/remote/__init__.py +2 -1
  94. flyte/remote/_client/_protocols.py +2 -0
  95. flyte/remote/_client/auth/_auth_utils.py +14 -0
  96. flyte/remote/_client/auth/_channel.py +34 -3
  97. flyte/remote/_client/auth/_token_client.py +3 -3
  98. flyte/remote/_client/controlplane.py +13 -13
  99. flyte/remote/_console.py +1 -1
  100. flyte/remote/_data.py +10 -6
  101. flyte/remote/_logs.py +89 -29
  102. flyte/remote/_project.py +8 -9
  103. flyte/remote/_run.py +228 -131
  104. flyte/remote/_secret.py +12 -12
  105. flyte/remote/_task.py +179 -15
  106. flyte/report/_report.py +4 -4
  107. flyte/storage/__init__.py +5 -0
  108. flyte/storage/_config.py +233 -0
  109. flyte/storage/_storage.py +23 -3
  110. flyte/syncify/__init__.py +56 -0
  111. flyte/syncify/_api.py +371 -0
  112. flyte/types/__init__.py +23 -0
  113. flyte/types/_interface.py +22 -7
  114. flyte/{io/pickle/transformer.py → types/_pickle.py} +2 -1
  115. flyte/types/_type_engine.py +95 -18
  116. flyte-0.2.0a0.dist-info/METADATA +249 -0
  117. flyte-0.2.0a0.dist-info/RECORD +218 -0
  118. {flyte-0.0.1b3.dist-info → flyte-0.2.0a0.dist-info}/entry_points.txt +1 -1
  119. flyte/_api_commons.py +0 -3
  120. flyte/_cli/__init__.py +0 -0
  121. flyte/_cli/_create.py +0 -42
  122. flyte/_cli/main.py +0 -72
  123. flyte/_internal/controllers/pbhash.py +0 -39
  124. flyte/io/_dataframe.py +0 -0
  125. flyte/io/pickle/__init__.py +0 -0
  126. flyte-0.0.1b3.dist-info/METADATA +0 -179
  127. flyte-0.0.1b3.dist-info/RECORD +0 -390
  128. union/__init__.py +0 -54
  129. union/_api_commons.py +0 -3
  130. union/_bin/__init__.py +0 -0
  131. union/_bin/runtime.py +0 -113
  132. union/_build.py +0 -25
  133. union/_cache/__init__.py +0 -12
  134. union/_cache/cache.py +0 -141
  135. union/_cache/defaults.py +0 -9
  136. union/_cache/policy_function_body.py +0 -42
  137. union/_cli/__init__.py +0 -0
  138. union/_cli/_common.py +0 -263
  139. union/_cli/_create.py +0 -40
  140. union/_cli/_delete.py +0 -23
  141. union/_cli/_deploy.py +0 -120
  142. union/_cli/_get.py +0 -162
  143. union/_cli/_run.py +0 -150
  144. union/_cli/main.py +0 -72
  145. union/_code_bundle/__init__.py +0 -8
  146. union/_code_bundle/_ignore.py +0 -113
  147. union/_code_bundle/_packaging.py +0 -187
  148. union/_code_bundle/_utils.py +0 -342
  149. union/_code_bundle/bundle.py +0 -176
  150. union/_context.py +0 -146
  151. union/_datastructures.py +0 -295
  152. union/_deploy.py +0 -185
  153. union/_doc.py +0 -29
  154. union/_docstring.py +0 -26
  155. union/_environment.py +0 -43
  156. union/_group.py +0 -31
  157. union/_hash.py +0 -23
  158. union/_image.py +0 -760
  159. union/_initialize.py +0 -585
  160. union/_interface.py +0 -84
  161. union/_internal/__init__.py +0 -3
  162. union/_internal/controllers/__init__.py +0 -77
  163. union/_internal/controllers/_local_controller.py +0 -77
  164. union/_internal/controllers/pbhash.py +0 -39
  165. union/_internal/controllers/remote/__init__.py +0 -40
  166. union/_internal/controllers/remote/_action.py +0 -131
  167. union/_internal/controllers/remote/_client.py +0 -43
  168. union/_internal/controllers/remote/_controller.py +0 -169
  169. union/_internal/controllers/remote/_core.py +0 -341
  170. union/_internal/controllers/remote/_informer.py +0 -260
  171. union/_internal/controllers/remote/_service_protocol.py +0 -44
  172. union/_internal/imagebuild/__init__.py +0 -11
  173. union/_internal/imagebuild/docker_builder.py +0 -416
  174. union/_internal/imagebuild/image_builder.py +0 -243
  175. union/_internal/imagebuild/remote_builder.py +0 -0
  176. union/_internal/resolvers/__init__.py +0 -0
  177. union/_internal/resolvers/_task_module.py +0 -31
  178. union/_internal/resolvers/common.py +0 -24
  179. union/_internal/resolvers/default.py +0 -27
  180. union/_internal/runtime/__init__.py +0 -0
  181. union/_internal/runtime/convert.py +0 -163
  182. union/_internal/runtime/entrypoints.py +0 -121
  183. union/_internal/runtime/io.py +0 -136
  184. union/_internal/runtime/resources_serde.py +0 -134
  185. union/_internal/runtime/task_serde.py +0 -202
  186. union/_internal/runtime/taskrunner.py +0 -179
  187. union/_internal/runtime/types_serde.py +0 -53
  188. union/_logging.py +0 -124
  189. union/_protos/__init__.py +0 -0
  190. union/_protos/common/authorization_pb2.py +0 -66
  191. union/_protos/common/authorization_pb2.pyi +0 -106
  192. union/_protos/common/identifier_pb2.py +0 -71
  193. union/_protos/common/identifier_pb2.pyi +0 -82
  194. union/_protos/common/identity_pb2.py +0 -48
  195. union/_protos/common/identity_pb2.pyi +0 -72
  196. union/_protos/common/identity_pb2_grpc.py +0 -4
  197. union/_protos/common/list_pb2.py +0 -36
  198. union/_protos/common/list_pb2.pyi +0 -69
  199. union/_protos/common/list_pb2_grpc.py +0 -4
  200. union/_protos/common/policy_pb2.py +0 -37
  201. union/_protos/common/policy_pb2.pyi +0 -27
  202. union/_protos/common/policy_pb2_grpc.py +0 -4
  203. union/_protos/common/role_pb2.py +0 -37
  204. union/_protos/common/role_pb2.pyi +0 -51
  205. union/_protos/common/role_pb2_grpc.py +0 -4
  206. union/_protos/common/runtime_version_pb2.py +0 -28
  207. union/_protos/common/runtime_version_pb2.pyi +0 -24
  208. union/_protos/common/runtime_version_pb2_grpc.py +0 -4
  209. union/_protos/logs/dataplane/payload_pb2.py +0 -96
  210. union/_protos/logs/dataplane/payload_pb2.pyi +0 -168
  211. union/_protos/logs/dataplane/payload_pb2_grpc.py +0 -4
  212. union/_protos/secret/definition_pb2.py +0 -49
  213. union/_protos/secret/definition_pb2.pyi +0 -93
  214. union/_protos/secret/definition_pb2_grpc.py +0 -4
  215. union/_protos/secret/payload_pb2.py +0 -62
  216. union/_protos/secret/payload_pb2.pyi +0 -94
  217. union/_protos/secret/payload_pb2_grpc.py +0 -4
  218. union/_protos/secret/secret_pb2.py +0 -38
  219. union/_protos/secret/secret_pb2.pyi +0 -6
  220. union/_protos/secret/secret_pb2_grpc.py +0 -198
  221. union/_protos/validate/validate/validate_pb2.py +0 -76
  222. union/_protos/workflow/node_execution_service_pb2.py +0 -26
  223. union/_protos/workflow/node_execution_service_pb2.pyi +0 -4
  224. union/_protos/workflow/node_execution_service_pb2_grpc.py +0 -32
  225. union/_protos/workflow/queue_service_pb2.py +0 -75
  226. union/_protos/workflow/queue_service_pb2.pyi +0 -103
  227. union/_protos/workflow/queue_service_pb2_grpc.py +0 -172
  228. union/_protos/workflow/run_definition_pb2.py +0 -100
  229. union/_protos/workflow/run_definition_pb2.pyi +0 -256
  230. union/_protos/workflow/run_definition_pb2_grpc.py +0 -4
  231. union/_protos/workflow/run_logs_service_pb2.py +0 -41
  232. union/_protos/workflow/run_logs_service_pb2.pyi +0 -28
  233. union/_protos/workflow/run_logs_service_pb2_grpc.py +0 -69
  234. union/_protos/workflow/run_service_pb2.py +0 -133
  235. union/_protos/workflow/run_service_pb2.pyi +0 -173
  236. union/_protos/workflow/run_service_pb2_grpc.py +0 -412
  237. union/_protos/workflow/state_service_pb2.py +0 -58
  238. union/_protos/workflow/state_service_pb2.pyi +0 -69
  239. union/_protos/workflow/state_service_pb2_grpc.py +0 -138
  240. union/_protos/workflow/task_definition_pb2.py +0 -72
  241. union/_protos/workflow/task_definition_pb2.pyi +0 -65
  242. union/_protos/workflow/task_definition_pb2_grpc.py +0 -4
  243. union/_protos/workflow/task_service_pb2.py +0 -44
  244. union/_protos/workflow/task_service_pb2.pyi +0 -31
  245. union/_protos/workflow/task_service_pb2_grpc.py +0 -104
  246. union/_resources.py +0 -226
  247. union/_retry.py +0 -32
  248. union/_reusable_environment.py +0 -25
  249. union/_run.py +0 -374
  250. union/_secret.py +0 -61
  251. union/_task.py +0 -354
  252. union/_task_environment.py +0 -186
  253. union/_timeout.py +0 -47
  254. union/_tools.py +0 -27
  255. union/_utils/__init__.py +0 -11
  256. union/_utils/asyn.py +0 -119
  257. union/_utils/file_handling.py +0 -71
  258. union/_utils/helpers.py +0 -46
  259. union/_utils/lazy_module.py +0 -54
  260. union/_utils/uv_script_parser.py +0 -49
  261. union/_version.py +0 -21
  262. union/connectors/__init__.py +0 -0
  263. union/errors.py +0 -128
  264. union/extras/__init__.py +0 -5
  265. union/extras/_container.py +0 -263
  266. union/io/__init__.py +0 -11
  267. union/io/_dataframe.py +0 -0
  268. union/io/_dir.py +0 -425
  269. union/io/_file.py +0 -418
  270. union/io/pickle/__init__.py +0 -0
  271. union/io/pickle/transformer.py +0 -117
  272. union/io/structured_dataset/__init__.py +0 -122
  273. union/io/structured_dataset/basic_dfs.py +0 -219
  274. union/io/structured_dataset/structured_dataset.py +0 -1057
  275. union/py.typed +0 -0
  276. union/remote/__init__.py +0 -23
  277. union/remote/_client/__init__.py +0 -0
  278. union/remote/_client/_protocols.py +0 -129
  279. union/remote/_client/auth/__init__.py +0 -12
  280. union/remote/_client/auth/_authenticators/__init__.py +0 -0
  281. union/remote/_client/auth/_authenticators/base.py +0 -391
  282. union/remote/_client/auth/_authenticators/client_credentials.py +0 -73
  283. union/remote/_client/auth/_authenticators/device_code.py +0 -120
  284. union/remote/_client/auth/_authenticators/external_command.py +0 -77
  285. union/remote/_client/auth/_authenticators/factory.py +0 -200
  286. union/remote/_client/auth/_authenticators/pkce.py +0 -515
  287. union/remote/_client/auth/_channel.py +0 -184
  288. union/remote/_client/auth/_client_config.py +0 -83
  289. union/remote/_client/auth/_default_html.py +0 -32
  290. union/remote/_client/auth/_grpc_utils/__init__.py +0 -0
  291. union/remote/_client/auth/_grpc_utils/auth_interceptor.py +0 -204
  292. union/remote/_client/auth/_grpc_utils/default_metadata_interceptor.py +0 -144
  293. union/remote/_client/auth/_keyring.py +0 -154
  294. union/remote/_client/auth/_token_client.py +0 -258
  295. union/remote/_client/auth/errors.py +0 -16
  296. union/remote/_client/controlplane.py +0 -86
  297. union/remote/_data.py +0 -149
  298. union/remote/_logs.py +0 -74
  299. union/remote/_project.py +0 -86
  300. union/remote/_run.py +0 -820
  301. union/remote/_secret.py +0 -132
  302. union/remote/_task.py +0 -193
  303. union/report/__init__.py +0 -3
  304. union/report/_report.py +0 -178
  305. union/report/_template.html +0 -124
  306. union/storage/__init__.py +0 -24
  307. union/storage/_remote_fs.py +0 -34
  308. union/storage/_storage.py +0 -247
  309. union/storage/_utils.py +0 -5
  310. union/types/__init__.py +0 -11
  311. union/types/_renderer.py +0 -162
  312. union/types/_string_literals.py +0 -120
  313. union/types/_type_engine.py +0 -2131
  314. union/types/_utils.py +0 -80
  315. /union/_protos/common/authorization_pb2_grpc.py → /flyte/_protos/workflow/common_pb2_grpc.py +0 -0
  316. /union/_protos/common/identifier_pb2_grpc.py → /flyte/_protos/workflow/environment_pb2_grpc.py +0 -0
  317. /flyte/io/{structured_dataset → _structured_dataset}/__init__.py +0 -0
  318. {flyte-0.0.1b3.dist-info → flyte-0.2.0a0.dist-info}/WHEEL +0 -0
  319. {flyte-0.0.1b3.dist-info → flyte-0.2.0a0.dist-info}/top_level.txt +0 -0
@@ -1,21 +1,21 @@
1
1
  import rich_click as click
2
2
 
3
- import flyte._cli._common as common
3
+ import flyte.cli._common as common
4
4
 
5
5
 
6
6
  @click.group(name="delete")
7
7
  def delete():
8
8
  """
9
- Delete a task or environment.
9
+ Remove resources from a Flyte deployment.
10
10
  """
11
11
 
12
12
 
13
- @click.command(cls=common.CommandBase)
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
 
@@ -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 pyflyte run workflow subcommand.
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
- print(f"Deploying environment: {self.obj_name}")
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
- return flyte.deploy(
81
- self.obj,
82
- dryrun=self.deploy_args.dry_run,
83
- copy_style=self.deploy_args.copy_style,
84
- version=self.deploy_args.version,
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.TaskEnvironment)}
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.TaskEnvironment, obj)
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="deploy one or more environments from a python file.",
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")
@@ -11,7 +11,23 @@ from . import _common as common
11
11
  @click.group(name="get")
12
12
  def get():
13
13
  """
14
- Get the value of a task or environment.
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 the current project.
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 the current run.
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
- Get the current task.
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 not version:
77
- raise click.BadParameter("Version is required when getting a task by name.")
78
- v = Task.get(name=name, version=version)
79
- if v is None:
80
- raise click.BadParameter(f"Task {name} not found.")
81
- t = v.fetch(v)
82
- console.print(pretty_repr(t))
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
- raise click.BadParameter("Task listing is not supported yet, please provide a name.")
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=False)
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
- "--follow",
121
- "-f",
143
+ "--pretty",
122
144
  is_flag=True,
123
145
  default=False,
124
- help="Follow the logs (like tail -f), will open a panel with logs scrolling.",
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
- follow: bool = True,
161
+ pretty: bool = True,
162
+ attempt: int | None = None,
163
+ filter_system: bool = False,
136
164
  ):
137
165
  """
138
- Get the current run.
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(_obj.show_logs(max_lines=lines, show_ts=show_ts, raw=not follow))
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 the current secret.
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)