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

Update sdk #201

Merged
merged 2 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion conda/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- pip=21.0.1
- python=3.7.10
- six=1.16.0
- globus-sdk=2.0.1
- globus-sdk=3.2.1
- fair-research-login=0.2.0
# Developer Tools
# =================
Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ requirements:
run:
- python >=3.6
- six
- globus-sdk >=2,<3
- globus-sdk >=2
- fair-research-login

test:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
packages=find_packages(include=["zstash", "zstash.*"]),
install_requires=[
"six==1.16.0",
"globus-sdk==2.0.1",
"fair-research-login==0.2.0",
"globus-sdk<4.0.0>=3.0.0",
"fair-research-login==0.2.6",
],
entry_points={"console_scripts": ["zstash=zstash.main:main"]},
)
9 changes: 5 additions & 4 deletions tests/test_globus.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import unittest

from fair_research_login.client import NativeClient
from globus_sdk import DeleteData, TransferClient
from globus_sdk.exc import TransferAPIError
from globus_sdk import DeleteData, TransferAPIError, TransferClient

from tests.base import TOP_LEVEL, ZSTASH_PATH, TestZstash, print_starred, run_cmd

Expand Down Expand Up @@ -63,7 +62,7 @@ def preactivate_globus(self):
transfer_authorizer = native_client.get_authorizers().get(
"transfer.api.globus.org"
)
self.transfer_client = TransferClient(transfer_authorizer)
self.transfer_client = TransferClient(authorizer=transfer_authorizer)

for ep_id in [hpss_globus_endpoint, local_endpoint]:
r = self.transfer_client.endpoint_autoactivate(ep_id, if_expires_in=600)
Expand Down Expand Up @@ -96,7 +95,9 @@ def delete_files_globus(self):
with 5 second timeout limit. If the task is ACTIVE after time runs
out 'task_wait' returns False, and True otherwise.
"""
while not self.transfer_client.task_wait(task_id, 5, 5):
while not self.transfer_client.task_wait(
task_id, timeout=5, polling_interval=5
):
task = self.transfer_client.get_task(task_id)
if task.get("is_paused"):
break
Expand Down
7 changes: 3 additions & 4 deletions zstash/globus.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import sys

from fair_research_login.client import NativeClient
from globus_sdk import TransferClient, TransferData
from globus_sdk.exc import TransferAPIError
from globus_sdk import TransferAPIError, TransferClient, TransferData

from .settings import logger

Expand Down Expand Up @@ -83,7 +82,7 @@ def globus_transfer( # noqa: C901
)
native_client.login(no_local_server=True, refresh_tokens=True)
transfer_authorizer = native_client.get_authorizers().get("transfer.api.globus.org")
tc = TransferClient(transfer_authorizer)
tc = TransferClient(authorizer=transfer_authorizer)

for ep_id in [src_ep, dst_ep]:
r = tc.endpoint_autoactivate(ep_id, if_expires_in=600)
Expand Down Expand Up @@ -134,7 +133,7 @@ def globus_transfer( # noqa: C901
with 20 second timeout limit. If the task is ACTIVE after time runs
out 'task_wait' returns False, and True otherwise.
"""
while not tc.task_wait(task_id, 20, 20):
while not tc.task_wait(task_id, timeout=20, polling_interval=20):
pass
"""
The Globus transfer job (task) has been finished (SUCCEEDED or FAILED).
Expand Down