diff --git a/changelog.d/20230808_111757_ada_add_iterable_run_logs_response.rst b/changelog.d/20230808_111757_ada_add_iterable_run_logs_response.rst new file mode 100644 index 000000000..4ebb444d1 --- /dev/null +++ b/changelog.d/20230808_111757_ada_add_iterable_run_logs_response.rst @@ -0,0 +1,4 @@ +Changed +~~~~~~~ + +- ``FlowsClient.get_run_logs()`` now uses an ``IterableRunLogsResponse``. (:pr:`NUMBER`) diff --git a/src/globus_sdk/services/flows/client.py b/src/globus_sdk/services/flows/client.py index 62d9d7b02..7df8d99bb 100644 --- a/src/globus_sdk/services/flows/client.py +++ b/src/globus_sdk/services/flows/client.py @@ -9,7 +9,11 @@ from globus_sdk.scopes import ScopeBuilder from .errors import FlowsAPIError -from .response import IterableFlowsResponse, IterableRunsResponse +from .response import ( + IterableFlowsResponse, + IterableRunLogsResponse, + IterableRunsResponse, +) from .scopes import SpecificFlowScopesClassStub log = logging.getLogger(__name__) @@ -545,7 +549,7 @@ def get_run_logs( reverse_order: bool | None = None, marker: str | None = None, query_params: dict[str, t.Any] | None = None, - ) -> IterableFlowsResponse: + ) -> IterableRunLogsResponse: """ Retrieve the execution logs associated with a run @@ -589,7 +593,7 @@ def get_run_logs( } # Filter out request keys with None values to allow server defaults query_params = {k: v for k, v in query_params.items() if v is not None} - return IterableFlowsResponse( + return IterableRunLogsResponse( self.get(f"/runs/{run_id}/log", query_params=query_params) ) diff --git a/src/globus_sdk/services/flows/response.py b/src/globus_sdk/services/flows/response.py index d03631499..b07cf0a28 100644 --- a/src/globus_sdk/services/flows/response.py +++ b/src/globus_sdk/services/flows/response.py @@ -15,3 +15,11 @@ class IterableRunsResponse(response.IterableResponse): """ default_iter_key = "runs" + + +class IterableRunLogsResponse(response.IterableResponse): + """ + An iterable response containing an "entries" array. + """ + + default_iter_key = "entries"