Skip to content

Commit

Permalink
Add IterableRunLogsResponse
Browse files Browse the repository at this point in the history
Signed-off-by: Ada <ada@globus.org>
  • Loading branch information
ada-globus committed Aug 8, 2023
1 parent f6aed51 commit 3c211b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changed
~~~~~~~

- ``FlowsClient.get_run_logs()`` now uses an ``IterableRunLogsResponse``. (:pr:`NUMBER`)
10 changes: 7 additions & 3 deletions src/globus_sdk/services/flows/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
)

Expand Down
8 changes: 8 additions & 0 deletions src/globus_sdk/services/flows/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 3c211b1

Please sign in to comment.