Skip to content

Commit 3eba80d

Browse files
committed
docs: Document raised exceptions in client methods
Replace `:raises: TODO` placeholders with actual exception documentation in RawSynchronousFlyteClient and SynchronousFlyteClient methods. The documented exceptions are based on the RetryExceptionWrapperInterceptor which converts gRPC status codes to Flyte exceptions: - FlyteAuthenticationException (UNAUTHENTICATED) - FlyteEntityNotExistException (NOT_FOUND) - FlyteEntityAlreadyExistsException (ALREADY_EXISTS) - FlyteInvalidInputException (INVALID_ARGUMENT) - FlyteSystemException (other errors) This improves API documentation and helps users understand what exceptions to expect when using the client methods.
1 parent 57db1e8 commit 3eba80d

File tree

2 files changed

+52
-16
lines changed

2 files changed

+52
-16
lines changed

flytekit/clients/friendly.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ def list_task_ids_paginated(self, project, domain, limit=100, token=None, sort_b
106106
If you previously retrieved a page response with token="foo" and you want the next page,
107107
specify token="foo". Please see the notes for this function about the caveats of the paginated API.
108108
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
109-
:raises: TODO
109+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
110+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
111+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
110112
:rtype: list[flytekit.models.common.NamedEntityIdentifier], Text
111113
"""
112114
identifier_list = super(SynchronousFlyteClient, self).list_task_ids_paginated(
@@ -146,7 +148,9 @@ def list_tasks_paginated(self, identifier, limit=100, token=None, filters=None,
146148
:param list[flytekit.models.filters.Filter] filters: [Optional] If specified, the filters will be applied to
147149
the query. If the filter is not supported, an exception will be raised.
148150
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
149-
:raises: TODO
151+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
152+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
153+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
150154
:rtype: list[flytekit.models.task.Task], Text
151155
"""
152156
task_list = super(SynchronousFlyteClient, self).list_tasks_paginated(
@@ -172,7 +176,10 @@ def get_task(self, id):
172176
This returns a single task for a given identifier.
173177
174178
:param flytekit.models.core.identifier.Identifier id: The ID representing a given task.
175-
:raises: TODO
179+
:raises flytekit.exceptions.user.FlyteEntityNotExistException: If the task does not exist.
180+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
181+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
182+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
176183
:rtype: flytekit.models.task.Task
177184
"""
178185
return _task.Task.from_flyte_idl(
@@ -231,7 +238,9 @@ def list_workflow_ids_paginated(self, project, domain, limit=100, token=None, so
231238
If you previously retrieved a page response with token="foo" and you want the next page,
232239
specify token="foo". Please see the notes for this function about the caveats of the paginated API.
233240
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
234-
:raises: TODO
241+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
242+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
243+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
235244
:rtype: list[flytekit.models.common.NamedEntityIdentifier], Text
236245
"""
237246
identifier_list = super(SynchronousFlyteClient, self).list_workflow_ids_paginated(
@@ -271,7 +280,9 @@ def list_workflows_paginated(self, identifier, limit=100, token=None, filters=No
271280
:param list[flytekit.models.filters.Filter] filters: [Optional] If specified, the filters will be applied to
272281
the query. If the filter is not supported, an exception will be raised.
273282
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
274-
:raises: TODO
283+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
284+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
285+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
275286
:rtype: list[flytekit.models.admin.workflow.Workflow], Text
276287
"""
277288
wf_list = super(SynchronousFlyteClient, self).list_workflows_paginated(
@@ -297,7 +308,10 @@ def get_workflow(self, id):
297308
This returns a single workflow for a given ID.
298309
299310
:param flytekit.models.core.identifier.Identifier id: The ID representing a given task.
300-
:raises: TODO
311+
:raises flytekit.exceptions.user.FlyteEntityNotExistException: If the workflow does not exist.
312+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
313+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
314+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
301315
:rtype: flytekit.models.admin.workflow.Workflow
302316
"""
303317
return _workflow.Workflow.from_flyte_idl(
@@ -383,7 +397,9 @@ def list_launch_plan_ids_paginated(self, project, domain, limit=100, token=None,
383397
If you previously retrieved a page response with token="foo" and you want the next page,
384398
specify token="foo". Please see the notes for this function about the caveats of the paginated API.
385399
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
386-
:raises: TODO
400+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
401+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
402+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
387403
:rtype: list[flytekit.models.common.NamedEntityIdentifier], Text
388404
"""
389405
identifier_list = super(SynchronousFlyteClient, self).list_launch_plan_ids_paginated(
@@ -423,7 +439,9 @@ def list_launch_plans_paginated(self, identifier, limit=100, token=None, filters
423439
:param list[flytekit.models.filters.Filter] filters: [Optional] If specified, the filters will be applied to
424440
the query. If the filter is not supported, an exception will be raised.
425441
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
426-
:raises: TODO
442+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
443+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
444+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
427445
:rtype: list[flytekit.models.launch_plan.LaunchPlan], str
428446
"""
429447
lp_list = super(SynchronousFlyteClient, self).list_launch_plans_paginated(
@@ -467,7 +485,9 @@ def list_active_launch_plans_paginated(
467485
If you previously retrieved a page response with token="foo" and you want the next page,
468486
specify token="foo". Please see the notes for this function about the caveats of the paginated API.
469487
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
470-
:raises: TODO
488+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
489+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
490+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
471491
:rtype: list[flytekit.models.launch_plan.LaunchPlan], str
472492
"""
473493
lp_list = super(SynchronousFlyteClient, self).list_active_launch_plans_paginated(
@@ -615,7 +635,9 @@ def list_executions_paginated(self, project, domain, limit=100, token=None, filt
615635
:param list[flytekit.models.filters.Filter] filters: [Optional] If specified, the filters will be applied to
616636
the query. If the filter is not supported, an exception will be raised.
617637
:param flytekit.models.admin.common.Sort sort_by: [Optional] If provided, the results will be sorted.
618-
:raises: TODO
638+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
639+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
640+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
619641
:rtype: (list[flytekit.models.execution.Execution], Text)
620642
"""
621643
exec_list = super(SynchronousFlyteClient, self).list_executions_paginated(

flytekit/clients/raw.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ def list_task_ids_paginated(self, identifier_list_request):
124124
125125
:param: flyteidl.admin.common_pb2.NamedEntityIdentifierListRequest identifier_list_request:
126126
:rtype: flyteidl.admin.common_pb2.NamedEntityIdentifierList
127-
:raises: TODO
127+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
128+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
129+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
128130
"""
129131
return self._stub.ListTaskIds(identifier_list_request, metadata=self._metadata)
130132

@@ -143,7 +145,9 @@ def list_tasks_paginated(self, resource_list_request):
143145
144146
:param: flyteidl.admin.common_pb2.ResourceListRequest resource_list_request:
145147
:rtype: flyteidl.admin.task_pb2.TaskList
146-
:raises: TODO
148+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
149+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
150+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
147151
"""
148152
return self._stub.ListTasks(resource_list_request, metadata=self._metadata)
149153

@@ -153,7 +157,10 @@ def get_task(self, get_object_request):
153157
154158
:param: flyteidl.admin.common_pb2.ObjectGetRequest get_object_request:
155159
:rtype: flyteidl.admin.task_pb2.Task
156-
:raises: TODO
160+
:raises flytekit.exceptions.user.FlyteEntityNotExistException: If the task does not exist.
161+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
162+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
163+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
157164
"""
158165
return self._stub.GetTask(get_object_request, metadata=self._metadata)
159166

@@ -212,7 +219,9 @@ def list_workflow_ids_paginated(self, identifier_list_request):
212219
213220
:param: flyteidl.admin.common_pb2.NamedEntityIdentifierListRequest identifier_list_request:
214221
:rtype: flyteidl.admin.common_pb2.NamedEntityIdentifierList
215-
:raises: TODO
222+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
223+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
224+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
216225
"""
217226
return self._stub.ListWorkflowIds(identifier_list_request, metadata=self._metadata)
218227

@@ -231,7 +240,9 @@ def list_workflows_paginated(self, resource_list_request):
231240
232241
:param: flyteidl.admin.common_pb2.ResourceListRequest resource_list_request:
233242
:rtype: flyteidl.admin.workflow_pb2.WorkflowList
234-
:raises: TODO
243+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
244+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
245+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
235246
"""
236247
return self._stub.ListWorkflows(resource_list_request, metadata=self._metadata)
237248

@@ -241,7 +252,10 @@ def get_workflow(self, get_object_request):
241252
242253
:param: flyteidl.admin.common_pb2.ObjectGetRequest get_object_request:
243254
:rtype: flyteidl.admin.workflow_pb2.Workflow
244-
:raises: TODO
255+
:raises flytekit.exceptions.user.FlyteEntityNotExistException: If the workflow does not exist.
256+
:raises flytekit.exceptions.user.FlyteAuthenticationException: If the request is not authenticated.
257+
:raises flytekit.exceptions.user.FlyteInvalidInputException: If the request contains invalid parameters.
258+
:raises flytekit.exceptions.system.FlyteSystemException: If an unexpected error occurs.
245259
"""
246260
return self._stub.GetWorkflow(get_object_request, metadata=self._metadata)
247261

0 commit comments

Comments
 (0)