rda-python-globus 1.0.2__tar.gz → 1.0.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rda_python_globus-1.0.2/src/rda_python_globus.egg-info → rda_python_globus-1.0.11}/PKG-INFO +5 -5
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/pyproject.toml +5 -5
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/file_management.py +16 -16
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/lib/__init__.py +3 -1
- rda_python_globus-1.0.11/src/rda_python_globus/lib/auth.py +57 -0
- rda_python_globus-1.0.11/src/rda_python_globus/lib/config.py +55 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/list.py +6 -2
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/transfer.py +24 -11
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11/src/rda_python_globus.egg-info}/PKG-INFO +5 -5
- rda_python_globus-1.0.11/src/rda_python_globus.egg-info/requires.txt +4 -0
- rda_python_globus-1.0.2/src/rda_python_globus/lib/auth.py +0 -40
- rda_python_globus-1.0.2/src/rda_python_globus/lib/config.py +0 -32
- rda_python_globus-1.0.2/src/rda_python_globus.egg-info/requires.txt +0 -4
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/LICENSE +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/README.md +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/setup.cfg +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/__init__.py +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/main.py +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/task_management.py +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/SOURCES.txt +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/dependency_links.txt +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/entry_points.txt +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/top_level.txt +0 -0
- {rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/tests/test_example.py +0 -0
{rda_python_globus-1.0.2/src/rda_python_globus.egg-info → rda_python_globus-1.0.11}/PKG-INFO
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_globus
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Tools for managing Globus transfers supporting the NSF NCAR
|
|
3
|
+
Version: 1.0.11
|
|
4
|
+
Summary: Tools for managing Globus transfers supporting the NSF NCAR Geoscience Data Exchange (GDEX) project.
|
|
5
5
|
Author-email: Thomas Cram <tcram@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-globus
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: globus_sdk
|
|
15
|
-
Requires-Dist: click
|
|
14
|
+
Requires-Dist: globus_sdk<4.0.0
|
|
15
|
+
Requires-Dist: click>=8.3.0
|
|
16
16
|
Requires-Dist: pyyaml
|
|
17
17
|
Requires-Dist: six
|
|
18
18
|
Dynamic: license-file
|
|
@@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "rda_python_globus"
|
|
9
|
-
version = "1.0.
|
|
9
|
+
version = "1.0.11"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name="Thomas Cram", email="tcram@ucar.edu" },
|
|
12
12
|
]
|
|
13
|
-
description = "Tools for managing Globus transfers supporting the NSF NCAR
|
|
13
|
+
description = "Tools for managing Globus transfers supporting the NSF NCAR Geoscience Data Exchange (GDEX) project."
|
|
14
14
|
readme = "README.md"
|
|
15
|
-
requires-python = ">=3.
|
|
15
|
+
requires-python = ">=3.11"
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Programming Language :: Python :: 3",
|
|
18
18
|
"License :: OSI Approved :: MIT License",
|
|
@@ -20,8 +20,8 @@ classifiers = [
|
|
|
20
20
|
"Development Status :: 5 - Production/Stable",
|
|
21
21
|
]
|
|
22
22
|
dependencies = [
|
|
23
|
-
"globus_sdk",
|
|
24
|
-
"click",
|
|
23
|
+
"globus_sdk<4.0.0",
|
|
24
|
+
"click>=8.3.0",
|
|
25
25
|
"pyyaml",
|
|
26
26
|
"six",
|
|
27
27
|
]
|
{rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/file_management.py
RENAMED
|
@@ -31,10 +31,10 @@ def add_batch_to_delete_data(batch, delete_data):
|
|
|
31
31
|
\b
|
|
32
32
|
=== Examples ===
|
|
33
33
|
\b
|
|
34
|
-
1. Create a directory on the
|
|
34
|
+
1. Create a directory on the GDEX Quasar endpoint:
|
|
35
35
|
\b
|
|
36
36
|
$ dsglobus mkdir \\
|
|
37
|
-
--endpoint
|
|
37
|
+
--endpoint gdex-quasar \\
|
|
38
38
|
--path /d999009/new_directory
|
|
39
39
|
'''
|
|
40
40
|
)
|
|
@@ -63,24 +63,24 @@ def mkdir_command(
|
|
|
63
63
|
\b
|
|
64
64
|
=== Examples ===
|
|
65
65
|
\b
|
|
66
|
-
1. Rename a single file on the
|
|
66
|
+
1. Rename a single file on the GDEX Quasar endpoint:
|
|
67
67
|
\b
|
|
68
68
|
$ dsglobus rename \\
|
|
69
|
-
--endpoint
|
|
69
|
+
--endpoint gdex-quasar \\
|
|
70
70
|
--old-path /d999009/old_file.txt \\
|
|
71
71
|
--new-path /d999009/new_file.txt
|
|
72
72
|
\b
|
|
73
|
-
2. Rename a directory on the
|
|
73
|
+
2. Rename a directory on the GDEX Quasar endpoint:
|
|
74
74
|
\b
|
|
75
75
|
$ dsglobus rename \\
|
|
76
|
-
--endpoint
|
|
76
|
+
--endpoint gdex-quasar \\
|
|
77
77
|
--old-path /d999009/old_directory \\
|
|
78
78
|
--new-path /d999009/new_directory
|
|
79
79
|
\b
|
|
80
|
-
3. Rename a batch of files/directories on the
|
|
80
|
+
3. Rename a batch of files/directories on the GDEX Quasar endpoint:
|
|
81
81
|
\b
|
|
82
82
|
$ dsglobus rename \\
|
|
83
|
-
--endpoint
|
|
83
|
+
--endpoint gdex-quasar \\
|
|
84
84
|
--batch /path/to/batch.json
|
|
85
85
|
\b
|
|
86
86
|
The batch file should contain a JSON array of file paths to rename.
|
|
@@ -105,7 +105,7 @@ def mkdir_command(
|
|
|
105
105
|
4. The batch files can also be read from stdin using '-':
|
|
106
106
|
\b
|
|
107
107
|
$ dsglobus rename \\
|
|
108
|
-
--endpoint
|
|
108
|
+
--endpoint gdex-quasar \\
|
|
109
109
|
--batch -
|
|
110
110
|
[
|
|
111
111
|
{
|
|
@@ -189,25 +189,25 @@ def rename_command(
|
|
|
189
189
|
\b
|
|
190
190
|
=== Examples ===
|
|
191
191
|
\b
|
|
192
|
-
1. Delete a single file on the
|
|
192
|
+
1. Delete a single file on the GDEX Quasar endpoint:
|
|
193
193
|
\b
|
|
194
194
|
$ dsglobus delete \\
|
|
195
|
-
--endpoint
|
|
195
|
+
--endpoint gdex-quasar \\
|
|
196
196
|
--target-file /d999009/file.txt
|
|
197
197
|
|
|
198
198
|
\b
|
|
199
|
-
2. Delete a directory on the
|
|
199
|
+
2. Delete a directory on the GDEX Quasar endpoint. --recursive is required
|
|
200
200
|
to delete a directory and its contents:
|
|
201
201
|
\b
|
|
202
202
|
$ dsglobus delete \\
|
|
203
|
-
--endpoint
|
|
203
|
+
--endpoint gdex-quasar \\
|
|
204
204
|
--target-file /d999009/dir \\
|
|
205
205
|
--recursive
|
|
206
206
|
\b
|
|
207
|
-
3. Delete a batch of files/directories on the
|
|
207
|
+
3. Delete a batch of files/directories on the GDEX Quasar endpoint:
|
|
208
208
|
\b
|
|
209
209
|
$ dsglobus delete \\
|
|
210
|
-
--endpoint
|
|
210
|
+
--endpoint gdex-quasar \\
|
|
211
211
|
--batch /path/to/batch.json \\
|
|
212
212
|
--recursive
|
|
213
213
|
\b
|
|
@@ -225,7 +225,7 @@ def rename_command(
|
|
|
225
225
|
4. The batch files can also be read from stdin using '-':
|
|
226
226
|
\b
|
|
227
227
|
$ dsglobus delete \\
|
|
228
|
-
--endpoint
|
|
228
|
+
--endpoint gdex-quasar \\
|
|
229
229
|
--recursive \\
|
|
230
230
|
--batch -
|
|
231
231
|
[
|
|
@@ -8,7 +8,7 @@ import six
|
|
|
8
8
|
import click
|
|
9
9
|
|
|
10
10
|
from .auth import token_storage_adapter, auth_client, transfer_client
|
|
11
|
-
from .config import ENDPOINT_ALIASES, LOGPATH, LOGFILE
|
|
11
|
+
from .config import ENDPOINT_ALIASES, LOGPATH, LOGFILE, TACC_GLOBUS_ENDPOINT, TACC_BASE_PATH
|
|
12
12
|
|
|
13
13
|
def common_options(f):
|
|
14
14
|
# any shared/common options for all commands
|
|
@@ -239,4 +239,6 @@ __all__ = (
|
|
|
239
239
|
"transfer_client",
|
|
240
240
|
"ENDPOINT_ALIASES",
|
|
241
241
|
"CustomEpilog",
|
|
242
|
+
"TACC_GLOBUS_ENDPOINT",
|
|
243
|
+
"TACC_BASE_PATH",
|
|
242
244
|
)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import globus_sdk
|
|
2
|
+
from globus_sdk.tokenstorage import JSONTokenStorage
|
|
3
|
+
from .config import (
|
|
4
|
+
QUASAR_CLIENT_ID,
|
|
5
|
+
TACC_CLIENT_ID,
|
|
6
|
+
CLIENT_TOKEN_CONFIG,
|
|
7
|
+
TACC_TOKEN_CONFIG,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
AUTH_RESOURCE_SERVER = "auth.globus.org"
|
|
11
|
+
AUTH_SCOPES = ["openid", "profile"]
|
|
12
|
+
TRANSFER_RESOURCE_SERVER = "transfer.api.globus.org"
|
|
13
|
+
TRANSFFER_SCOPES = "urn:globus:auth:scope:transfer.api.globus.org:all"
|
|
14
|
+
|
|
15
|
+
def token_storage_adapter(namespace="DEFAULT"):
|
|
16
|
+
""" Return a JSONTokenStorage instance for the specified namespace. If an instance already exists, return the existing instance. """
|
|
17
|
+
if namespace == "tacc":
|
|
18
|
+
json_config = TACC_TOKEN_CONFIG
|
|
19
|
+
else:
|
|
20
|
+
json_config = CLIENT_TOKEN_CONFIG
|
|
21
|
+
|
|
22
|
+
if not hasattr(token_storage_adapter, "_instance"):
|
|
23
|
+
token_storage_adapter._instance = JSONTokenStorage(json_config, namespace=namespace)
|
|
24
|
+
return token_storage_adapter._instance
|
|
25
|
+
|
|
26
|
+
def internal_auth_client(client_id=QUASAR_CLIENT_ID):
|
|
27
|
+
""" Return a NativeAppAuthClient instance for the specified client ID. """
|
|
28
|
+
return globus_sdk.NativeAppAuthClient(client_id, app_name="dsglobus")
|
|
29
|
+
|
|
30
|
+
def auth_client():
|
|
31
|
+
authorizer = globus_sdk.ClientCredentialsAuthorizer(internal_auth_client(), AUTH_SCOPES)
|
|
32
|
+
return globus_sdk.AuthClient(authorizer=authorizer, app_name="dsglobus")
|
|
33
|
+
|
|
34
|
+
def transfer_client(namespace="DEFAULT"):
|
|
35
|
+
""" Return a TransferClient instance for the specified namespace. """
|
|
36
|
+
|
|
37
|
+
if namespace == 'tacc':
|
|
38
|
+
client_id = TACC_CLIENT_ID
|
|
39
|
+
else:
|
|
40
|
+
client_id = QUASAR_CLIENT_ID
|
|
41
|
+
|
|
42
|
+
auth_client = internal_auth_client(client_id=client_id)
|
|
43
|
+
|
|
44
|
+
storage_adapter = token_storage_adapter(namespace)
|
|
45
|
+
token_data = storage_adapter.get_token_data(TRANSFER_RESOURCE_SERVER)
|
|
46
|
+
access_token = token_data.access_token
|
|
47
|
+
refresh_token = token_data.refresh_token
|
|
48
|
+
access_token_expires = token_data.expires_at_seconds
|
|
49
|
+
|
|
50
|
+
authorizer = globus_sdk.RefreshTokenAuthorizer(
|
|
51
|
+
refresh_token,
|
|
52
|
+
auth_client,
|
|
53
|
+
access_token=access_token,
|
|
54
|
+
expires_at=int(access_token_expires),
|
|
55
|
+
on_refresh=storage_adapter.store_token_response(auth_client.oauth2_refresh_token(refresh_token)),
|
|
56
|
+
)
|
|
57
|
+
return globus_sdk.TransferClient(authorizer=authorizer, app_name="dsglobus")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
""" Globus Client IDs """
|
|
4
|
+
QUASAR_CLIENT_ID = "05c2f58b-c667-4fc4-94fb-546e1cd8f41f"
|
|
5
|
+
TACC_CLIENT_ID = "3320e8d9-030c-41d0-94f0-2357ae2e3e4d"
|
|
6
|
+
|
|
7
|
+
""" Token storage configuration """
|
|
8
|
+
CLIENT_TOKEN_CONFIG = '/glade/u/home/gdexdata/globus/globus_gdex_quasar_tokens.json'
|
|
9
|
+
TACC_TOKEN_CONFIG = '/glade/u/home/gdexdata/globus/globus_tacc_transfer_tokens.json'
|
|
10
|
+
|
|
11
|
+
""" Log file path and name """
|
|
12
|
+
GDEX_BASE_PATH = '/glade/campaign/collections/gdex'
|
|
13
|
+
SCRATCH_PATH = '/lustre/desc1/scratch/tcram'
|
|
14
|
+
LOGPATH = os.path.join(SCRATCH_PATH, 'logs/globus')
|
|
15
|
+
LOGFILE = 'dsglobus-app.log'
|
|
16
|
+
|
|
17
|
+
""" Endpoint IDs """
|
|
18
|
+
RDA_DATASET_ENDPOINT = 'b6b5d5e8-eb14-4f6b-8928-c02429d67998'
|
|
19
|
+
RDA_DSRQST_ENDPOINT = 'e6cd9f43-935c-42e3-8d19-764d03241719'
|
|
20
|
+
RDA_STRATUS_ENDPOINT = 'be4aa6a8-9e35-11eb-8a8e-d70d98a40c8d'
|
|
21
|
+
RDA_GLADE_ENDPOINT = '7f0acd80-dfb2-4412-b7b5-ebc970bedf24'
|
|
22
|
+
RDA_QUASAR_ENDPOINT = 'e50caa88-feae-11ea-81a2-0e2f230cc907'
|
|
23
|
+
RDA_QUASAR_DR_ENDPOINT = '4c42c32c-feaf-11ea-81a2-0e2f230cc907'
|
|
24
|
+
GLOBUS_CGD_ENDPOINT_ID = '11651c26-80c2-4dac-a236-7755530731ac'
|
|
25
|
+
|
|
26
|
+
GDEX_DATASET_ENDPOINT = 'c4e40965-a024-43d7-bef4-6010f3731b61'
|
|
27
|
+
GDEX_DSRQST_ENDPOINT = 'e6cd9f43-935c-42e3-8d19-764d03241719'
|
|
28
|
+
GDEX_STRATUS_ENDPOINT = RDA_STRATUS_ENDPOINT # same as RDA Stratus
|
|
29
|
+
GDEX_OS_ENDPOINT = '558ad782-80dd-4656-a64a-2245f38a7c9e' # GDEX Boreas S3 guest collection
|
|
30
|
+
GDEX_GLADE_ENDPOINT = '039e1667-8a6c-4cbd-8e26-1f86c72f6e89'
|
|
31
|
+
GDEX_QUASAR_ENDPOINT = RDA_QUASAR_ENDPOINT # same as RDA Quasar
|
|
32
|
+
GDEX_QUASAR_DR_ENDPOINT = RDA_QUASAR_DR_ENDPOINT # same as RDA Quasar DR
|
|
33
|
+
|
|
34
|
+
TACC_GLOBUS_ENDPOINT = '57c4032a-2b50-47f0-adf8-13fff3a7d77d'
|
|
35
|
+
TACC_BASE_PATH = '/scoutfs/projects/ASC26015'
|
|
36
|
+
|
|
37
|
+
""" Endpoint aliases """
|
|
38
|
+
ENDPOINT_ALIASES = {
|
|
39
|
+
"rda-glade": RDA_GLADE_ENDPOINT,
|
|
40
|
+
"rda-quasar": RDA_QUASAR_ENDPOINT,
|
|
41
|
+
"rda-quasar-drdata": RDA_QUASAR_DR_ENDPOINT,
|
|
42
|
+
"rda-dataset": RDA_DATASET_ENDPOINT,
|
|
43
|
+
"rda-dsrqst": RDA_DSRQST_ENDPOINT,
|
|
44
|
+
"rda-stratus": RDA_STRATUS_ENDPOINT,
|
|
45
|
+
"gdex-glade": GDEX_GLADE_ENDPOINT,
|
|
46
|
+
"gdex-quasar": GDEX_QUASAR_ENDPOINT,
|
|
47
|
+
"gdex-quasar-drdata": GDEX_QUASAR_DR_ENDPOINT,
|
|
48
|
+
"gdex-dataset": GDEX_DATASET_ENDPOINT,
|
|
49
|
+
"gdex-dsrqst": GDEX_DSRQST_ENDPOINT,
|
|
50
|
+
"gdex-stratus": GDEX_STRATUS_ENDPOINT,
|
|
51
|
+
"gdex-os": GDEX_OS_ENDPOINT,
|
|
52
|
+
"gdex-boreas": GDEX_OS_ENDPOINT,
|
|
53
|
+
"cgd": GLOBUS_CGD_ENDPOINT_ID,
|
|
54
|
+
"tacc": TACC_GLOBUS_ENDPOINT
|
|
55
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import click
|
|
2
|
-
from globus_sdk import TransferData, GlobusAPIError, NetworkError
|
|
3
2
|
|
|
4
3
|
from .lib import (
|
|
5
4
|
common_options,
|
|
@@ -7,6 +6,7 @@ from .lib import (
|
|
|
7
6
|
path_options,
|
|
8
7
|
print_table,
|
|
9
8
|
transfer_client,
|
|
9
|
+
TACC_GLOBUS_ENDPOINT
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
import logging
|
|
@@ -80,7 +80,11 @@ def ls_command(
|
|
|
80
80
|
("Filename", cleaned_item_name),
|
|
81
81
|
]
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
if endpoint == TACC_GLOBUS_ENDPOINT:
|
|
84
|
+
tc = transfer_client(namespace="tacc")
|
|
85
|
+
else:
|
|
86
|
+
tc = transfer_client()
|
|
87
|
+
|
|
84
88
|
ls_response = tc.operation_ls(endpoint, **ls_params)
|
|
85
89
|
print_table(ls_response, fields)
|
|
86
90
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import sys
|
|
2
3
|
import json
|
|
3
4
|
import typing as t
|
|
@@ -12,12 +13,14 @@ from .lib import (
|
|
|
12
13
|
transfer_client,
|
|
13
14
|
process_json_stream,
|
|
14
15
|
validate_endpoint,
|
|
16
|
+
TACC_BASE_PATH,
|
|
17
|
+
TACC_GLOBUS_ENDPOINT,
|
|
15
18
|
)
|
|
16
19
|
|
|
17
20
|
import logging
|
|
18
21
|
logger = logging.getLogger(__name__)
|
|
19
22
|
|
|
20
|
-
def add_batch_to_transfer_data(batch, transfer_data):
|
|
23
|
+
def add_batch_to_transfer_data(batch, transfer_data, destination_endpoint):
|
|
21
24
|
""" Add batch of files to transfer data object. """
|
|
22
25
|
|
|
23
26
|
batch_json = process_json_stream(batch)
|
|
@@ -30,7 +33,10 @@ def add_batch_to_transfer_data(batch, transfer_data):
|
|
|
30
33
|
|
|
31
34
|
for i in range(len(files)):
|
|
32
35
|
source_file = files[i]['source_file']
|
|
33
|
-
dest_file = files[i]['destination_file']
|
|
36
|
+
dest_file = files[i]['destination_file']
|
|
37
|
+
if destination_endpoint == TACC_GLOBUS_ENDPOINT:
|
|
38
|
+
# prepend TACC base path to destination file
|
|
39
|
+
dest_file = os.path.join(TACC_BASE_PATH, dest_file.lstrip('/'))
|
|
34
40
|
transfer_data.add_item(source_file, dest_file)
|
|
35
41
|
|
|
36
42
|
return transfer_data
|
|
@@ -40,20 +46,21 @@ def add_batch_to_transfer_data(batch, transfer_data):
|
|
|
40
46
|
help="Submit a Globus transfer task.",
|
|
41
47
|
epilog='''
|
|
42
48
|
\b
|
|
43
|
-
=== Valid
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
49
|
+
=== Valid GDEX endpoint names ===
|
|
50
|
+
- gdex-glade
|
|
51
|
+
- gdex-quasar
|
|
52
|
+
- gdex-quasar-drdata
|
|
53
|
+
- tacc # TACC transfer endpoint, for transfers to/from TACC only
|
|
47
54
|
|
|
48
55
|
\b
|
|
49
56
|
=== Examples ===
|
|
50
57
|
\b
|
|
51
|
-
1. Transfer a single file from GLADE to the
|
|
58
|
+
1. Transfer a single file from GLADE to the Quasar tape system:
|
|
52
59
|
|
|
53
60
|
\b
|
|
54
61
|
$ dsglobus transfer \\
|
|
55
|
-
--source-endpoint
|
|
56
|
-
--destination-endpoint
|
|
62
|
+
--source-endpoint gdex-glade \\
|
|
63
|
+
--destination-endpoint gdex-quasar \\
|
|
57
64
|
--source-file /data/d999009/file.txt \\
|
|
58
65
|
--destination-file /d999009/file.txt
|
|
59
66
|
|
|
@@ -141,7 +148,10 @@ def transfer_command(
|
|
|
141
148
|
if source_file is None and destination_file is None and batch is None:
|
|
142
149
|
raise click.UsageError('--source-file and --destination-file, or --batch is required.')
|
|
143
150
|
|
|
144
|
-
|
|
151
|
+
if source_endpoint == TACC_GLOBUS_ENDPOINT or destination_endpoint == TACC_GLOBUS_ENDPOINT:
|
|
152
|
+
tc = transfer_client(namespace="tacc")
|
|
153
|
+
else:
|
|
154
|
+
tc = transfer_client()
|
|
145
155
|
|
|
146
156
|
transfer_data = TransferData(
|
|
147
157
|
transfer_client=tc,
|
|
@@ -152,10 +162,13 @@ def transfer_command(
|
|
|
152
162
|
)
|
|
153
163
|
|
|
154
164
|
if batch:
|
|
155
|
-
transfer_data = add_batch_to_transfer_data(batch, transfer_data)
|
|
165
|
+
transfer_data = add_batch_to_transfer_data(batch, transfer_data, destination_endpoint)
|
|
156
166
|
else:
|
|
157
167
|
if source_file is None or destination_file is None:
|
|
158
168
|
raise click.UsageError('--source-file and --destination-file are required is --batch is not used.')
|
|
169
|
+
if destination_endpoint == TACC_GLOBUS_ENDPOINT:
|
|
170
|
+
# prepend TACC base path to destination file
|
|
171
|
+
destination_file = os.path.join(TACC_BASE_PATH, destination_file.lstrip('/'))
|
|
159
172
|
transfer_data.add_item(source_file, destination_file)
|
|
160
173
|
|
|
161
174
|
if dry_run:
|
{rda_python_globus-1.0.2 → rda_python_globus-1.0.11/src/rda_python_globus.egg-info}/PKG-INFO
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_globus
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Tools for managing Globus transfers supporting the NSF NCAR
|
|
3
|
+
Version: 1.0.11
|
|
4
|
+
Summary: Tools for managing Globus transfers supporting the NSF NCAR Geoscience Data Exchange (GDEX) project.
|
|
5
5
|
Author-email: Thomas Cram <tcram@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-globus
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: globus_sdk
|
|
15
|
-
Requires-Dist: click
|
|
14
|
+
Requires-Dist: globus_sdk<4.0.0
|
|
15
|
+
Requires-Dist: click>=8.3.0
|
|
16
16
|
Requires-Dist: pyyaml
|
|
17
17
|
Requires-Dist: six
|
|
18
18
|
Dynamic: license-file
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import globus_sdk
|
|
2
|
-
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
|
|
3
|
-
from .config import (
|
|
4
|
-
CLIENT_ID,
|
|
5
|
-
CLIENT_TOKEN_CONFIG,
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
AUTH_RESOURCE_SERVER = "auth.globus.org"
|
|
9
|
-
AUTH_SCOPES = ["openid", "profile"]
|
|
10
|
-
TRANSFER_RESOURCE_SERVER = "transfer.api.globus.org"
|
|
11
|
-
TRANSFFER_SCOPES = "urn:globus:auth:scope:transfer.api.globus.org:all"
|
|
12
|
-
|
|
13
|
-
def token_storage_adapter():
|
|
14
|
-
if not hasattr(token_storage_adapter, "_instance"):
|
|
15
|
-
token_storage_adapter._instance = SimpleJSONFileAdapter(CLIENT_TOKEN_CONFIG)
|
|
16
|
-
return token_storage_adapter._instance
|
|
17
|
-
|
|
18
|
-
def internal_auth_client():
|
|
19
|
-
return globus_sdk.NativeAppAuthClient(CLIENT_ID, app_name="dsglobus")
|
|
20
|
-
|
|
21
|
-
def auth_client():
|
|
22
|
-
authorizer = globus_sdk.ClientCredentialsAuthorizer(internal_auth_client(), AUTH_SCOPES)
|
|
23
|
-
return globus_sdk.AuthClient(authorizer=authorizer, app_name="dsglobus")
|
|
24
|
-
|
|
25
|
-
def transfer_client():
|
|
26
|
-
storage_adapter = token_storage_adapter()
|
|
27
|
-
token_data = storage_adapter.get_token_data(TRANSFER_RESOURCE_SERVER)
|
|
28
|
-
|
|
29
|
-
access_token = token_data["access_token"]
|
|
30
|
-
refresh_token = token_data["refresh_token"]
|
|
31
|
-
access_token_expires = token_data["expires_at_seconds"]
|
|
32
|
-
authorizer = globus_sdk.RefreshTokenAuthorizer(
|
|
33
|
-
refresh_token,
|
|
34
|
-
internal_auth_client(),
|
|
35
|
-
access_token=access_token,
|
|
36
|
-
expires_at=int(access_token_expires),
|
|
37
|
-
on_refresh=storage_adapter.on_refresh,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
return globus_sdk.TransferClient(authorizer=authorizer, app_name="dsglobus")
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
""" RDA Quasar Client ID """
|
|
4
|
-
CLIENT_ID = "05c2f58b-c667-4fc4-94fb-546e1cd8f41f"
|
|
5
|
-
|
|
6
|
-
""" Token storage configuration """
|
|
7
|
-
CLIENT_TOKEN_CONFIG = '/glade/u/home/rdadata/lib/python/globus_rda_quasar_tokens.json'
|
|
8
|
-
|
|
9
|
-
""" Log file path and name """
|
|
10
|
-
RDA_BASE_PATH = '/glade/campaign/collections/rda'
|
|
11
|
-
LOGPATH = os.path.join(RDA_BASE_PATH, 'work/tcram/logs/globus')
|
|
12
|
-
LOGFILE = 'dsglobus-app.log'
|
|
13
|
-
|
|
14
|
-
""" Endpoint IDs """
|
|
15
|
-
RDA_DATASET_ENDPOINT = 'b6b5d5e8-eb14-4f6b-8928-c02429d67998'
|
|
16
|
-
RDA_DSRQST_ENDPOINT = 'e1e2997e-d794-4868-838e-d4b8d5590853'
|
|
17
|
-
RDA_STRATUS_ENDPOINT = 'be4aa6a8-9e35-11eb-8a8e-d70d98a40c8d'
|
|
18
|
-
RDA_GLADE_ENDPOINT = '7f0acd80-dfb2-4412-b7b5-ebc970bedf24'
|
|
19
|
-
RDA_QUASAR_ENDPOINT = 'e50caa88-feae-11ea-81a2-0e2f230cc907'
|
|
20
|
-
RDA_QUASAR_DR_ENDPOINT = '4c42c32c-feaf-11ea-81a2-0e2f230cc907'
|
|
21
|
-
GLOBUS_CGD_ENDPOINT_ID = '11651c26-80c2-4dac-a236-7755530731ac'
|
|
22
|
-
|
|
23
|
-
""" Endpoint aliases """
|
|
24
|
-
ENDPOINT_ALIASES = {
|
|
25
|
-
"rda-glade": RDA_GLADE_ENDPOINT,
|
|
26
|
-
"rda-quasar": RDA_QUASAR_ENDPOINT,
|
|
27
|
-
"rda-quasar-drdata": RDA_QUASAR_DR_ENDPOINT,
|
|
28
|
-
"rda-dataset": RDA_DATASET_ENDPOINT,
|
|
29
|
-
"rda-dsrqst": RDA_DSRQST_ENDPOINT,
|
|
30
|
-
"rda-stratus": RDA_STRATUS_ENDPOINT,
|
|
31
|
-
"cgd": GLOBUS_CGD_ENDPOINT_ID,
|
|
32
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus/task_management.py
RENAMED
|
File without changes
|
{rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{rda_python_globus-1.0.2 → rda_python_globus-1.0.11}/src/rda_python_globus.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|