-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve support for Transfer
filter
params
This started from the fact that `task_list` was missing first-class support for `filter`. Users would have to pass it via `query_params` previously. However, after clearing up some confusion about how to write a filter string, it seems that we could provide a better interface for passing these filters. Rather than an elaborate new ``TransferFilterDict`` object -- a briefly considered approach -- this adds support for passing a dict of strings or string lists. Lists get comma-separated, strings get passed unmodified. The resulting semantics allow for usages like tc.task_list(filter={"task_id": [...]}) tc.operation_ls(filter={"type": "file"}) which are relatively intuitive to read and are handled correctly by the SDK for the user. A new test for task_list exercises the various filter behaviors (and, NB, relies a little on cpython 3.6+ having order-preserving dicts).
- Loading branch information
Showing
4 changed files
with
185 additions
and
8 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
changelog.d/20211008_144403_sirosen_better_transfer_filters.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.. | ||
.. A new scriv changelog fragment | ||
.. | ||
.. Add one or more items to the list below describing the change in clear, concise terms. | ||
.. | ||
.. Leave the ":pr:`...`" text alone. When you open a pull request, GitHub Actions will | ||
.. automatically replace it in a new commit. (You can squash this commit later | ||
.. if you like.) | ||
.. | ||
* Add ``filter`` as a supported parameter to ``TransferClient.task_list`` (:pr:`NUMBER`) | ||
* The ``filter`` parameter to ``TransferClient.task_list`` and | ||
``TransferClient.operation_ls`` can now be passed as a ``Dict[str, str | List[str]]``. | ||
Documentation on the ``TransferClient`` explains how this will be formatted, | ||
and is linked from the param docs for ``filter`` on each method (:pr:`NUMBER`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"DATA": [ | ||
{ | ||
"bytes_checksummed": 0, | ||
"bytes_transferred": 4, | ||
"canceled_by_admin": null, | ||
"canceled_by_admin_message": null, | ||
"command": "API 0.10", | ||
"completion_time": "2021-09-02T18:04:49+00:00", | ||
"deadline": "2021-09-03T18:04:47+00:00", | ||
"delete_destination_extra": false, | ||
"destination_endpoint": "go#ep2", | ||
"destination_endpoint_display_name": "Globus Tutorial Endpoint 2", | ||
"destination_endpoint_id": "ddb59af0-6d04-11e5-ba46-22000b92c6ec", | ||
"directories": 0, | ||
"effective_bytes_per_second": 3, | ||
"encrypt_data": false, | ||
"fail_on_quota_errors": false, | ||
"fatal_error": null, | ||
"faults": 0, | ||
"files": 1, | ||
"files_skipped": 0, | ||
"files_transferred": 1, | ||
"filter_rules": null, | ||
"history_deleted": false, | ||
"is_ok": null, | ||
"is_paused": false, | ||
"label": null, | ||
"nice_status": null, | ||
"nice_status_details": null, | ||
"nice_status_expires_in": null, | ||
"nice_status_short_description": null, | ||
"owner_id": "5276fa05-eedf-46c5-919f-ad2d0160d1a9", | ||
"preserve_timestamp": false, | ||
"recursive_symlinks": "ignore", | ||
"request_time": "2021-09-02T18:04:47+00:00", | ||
"skip_source_errors": false, | ||
"source_endpoint": "go#ep1", | ||
"source_endpoint_display_name": "Globus Tutorial Endpoint 1", | ||
"source_endpoint_id": "ddb59aef-6d04-11e5-ba46-22000b92c6ec", | ||
"status": "SUCCEEDED", | ||
"subtasks_canceled": 0, | ||
"subtasks_expired": 0, | ||
"subtasks_failed": 0, | ||
"subtasks_pending": 0, | ||
"subtasks_retrying": 0, | ||
"subtasks_skipped_errors": 0, | ||
"subtasks_succeeded": 2, | ||
"subtasks_total": 2, | ||
"symlinks": 0, | ||
"sync_level": null, | ||
"task_id": "42277910-0c18-11ec-ba76-138ac5bdb19f", | ||
"type": "TRANSFER", | ||
"username": "u_XrtivK6z9w2MZwr65os6nZX0wv", | ||
"verify_checksum": true | ||
} | ||
], | ||
"DATA_TYPE": "task_list", | ||
"length": 1, | ||
"limit": 1000, | ||
"offset": 0, | ||
"total": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters