Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'orderby' to TransferClient.task_list #1011

Merged
merged 5 commits into from
Jul 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/globus_sdk/services/transfer/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ def task_list(
:param offset: offset used in paging
:param orderby: One or more order-by options. Each option is
either a field name or a field name followed by a space and 'ASC' or 'DESC'
for ascending or descending.
for ascending or descending. See example usage for details.
:param filter: Only return task documents which match these filter clauses. For
the filter syntax, see the **External Documentation** linked below. If a
dict is supplied as the filter, it is formatted as a set of filter clauses.
Expand Down Expand Up @@ -1553,6 +1553,20 @@ def task_list(
f"{task['source_endpoint']} -> {task['destination_endpoint']}"
)

Fetch the last 5 failed tasks by submission time:

tc = TransferClient(...)
sirosen marked this conversation as resolved.
Show resolved Hide resolved
for task in tc.task_list(
limit=5,
orderby="request_time DESC",
filter={"status": "FAILED"}
):
print(
f"Task({task['task_id']}) failed: "
f"{task['source_endpoint']} -> {task['destination_endpoint']}"
)


.. tab-item:: Paginated Usage

.. paginatedusage:: task_list
Expand Down