rda-python-globus 1.0.13__tar.gz → 1.0.17__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.13/src/rda_python_globus.egg-info → rda_python_globus-1.0.17}/PKG-INFO +1 -1
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/pyproject.toml +1 -1
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/file_management.py +11 -4
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/lib/__init__.py +12 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/task_management.py +60 -5
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17/src/rda_python_globus.egg-info}/PKG-INFO +1 -1
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/LICENSE +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/README.md +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/setup.cfg +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/__init__.py +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/lib/auth.py +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/lib/config.py +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/list.py +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/main.py +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/transfer.py +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/SOURCES.txt +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/dependency_links.txt +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/entry_points.txt +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/requires.txt +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/top_level.txt +0 -0
- {rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/tests/test_example.py +0 -0
{rda_python_globus-1.0.13/src/rda_python_globus.egg-info → rda_python_globus-1.0.17}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_globus
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.17
|
|
4
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
|
{rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/file_management.py
RENAMED
|
@@ -9,6 +9,7 @@ from .lib import (
|
|
|
9
9
|
task_submission_options,
|
|
10
10
|
path_options,
|
|
11
11
|
endpoint_options,
|
|
12
|
+
namespace_options,
|
|
12
13
|
transfer_client,
|
|
13
14
|
process_json_stream,
|
|
14
15
|
)
|
|
@@ -40,15 +41,17 @@ def add_batch_to_delete_data(batch, delete_data):
|
|
|
40
41
|
)
|
|
41
42
|
@endpoint_options
|
|
42
43
|
@path_options
|
|
44
|
+
@namespace_options
|
|
43
45
|
@common_options
|
|
44
46
|
def mkdir_command(
|
|
45
47
|
endpoint: str,
|
|
46
48
|
path: str,
|
|
49
|
+
namespace: str
|
|
47
50
|
) -> None:
|
|
48
51
|
"""
|
|
49
52
|
Create a directory on a Globus endpoint. Directory path is relative to the endpoint host path.
|
|
50
53
|
"""
|
|
51
|
-
tc = transfer_client()
|
|
54
|
+
tc = transfer_client(namespace=namespace)
|
|
52
55
|
try:
|
|
53
56
|
res = tc.operation_mkdir(endpoint, path=path)
|
|
54
57
|
click.echo(f"{res['message']}")
|
|
@@ -146,12 +149,14 @@ def mkdir_command(
|
|
|
146
149
|
"""),
|
|
147
150
|
)
|
|
148
151
|
@endpoint_options
|
|
152
|
+
@namespace_options
|
|
149
153
|
@common_options
|
|
150
154
|
def rename_command(
|
|
151
155
|
endpoint: str,
|
|
152
156
|
old_path: str,
|
|
153
157
|
new_path: str,
|
|
154
|
-
batch: t.TextIO
|
|
158
|
+
batch: t.TextIO,
|
|
159
|
+
namespace: str
|
|
155
160
|
) -> None:
|
|
156
161
|
"""
|
|
157
162
|
Rename a file or directory on a Globus endpoint. Path is relative to the endpoint host path.
|
|
@@ -171,7 +176,7 @@ def rename_command(
|
|
|
171
176
|
}
|
|
172
177
|
]
|
|
173
178
|
|
|
174
|
-
tc = transfer_client()
|
|
179
|
+
tc = transfer_client(namespace=namespace)
|
|
175
180
|
for file in files:
|
|
176
181
|
old_path = file["old_path"]
|
|
177
182
|
new_path = file["new_path"]
|
|
@@ -262,6 +267,7 @@ def rename_command(
|
|
|
262
267
|
)
|
|
263
268
|
@endpoint_options
|
|
264
269
|
@task_submission_options
|
|
270
|
+
@namespace_options
|
|
265
271
|
@common_options
|
|
266
272
|
def delete_command(
|
|
267
273
|
endpoint: str,
|
|
@@ -270,12 +276,13 @@ def delete_command(
|
|
|
270
276
|
batch: t.TextIO,
|
|
271
277
|
dry_run: bool,
|
|
272
278
|
recursive: bool,
|
|
279
|
+
namespace: str,
|
|
273
280
|
) -> None:
|
|
274
281
|
"""
|
|
275
282
|
Delete files and/or directories on a Globus endpoint. Directory
|
|
276
283
|
path is relative to the endpoint host path.
|
|
277
284
|
"""
|
|
278
|
-
tc = transfer_client()
|
|
285
|
+
tc = transfer_client(namespace=namespace)
|
|
279
286
|
delete_data = DeleteData(tc, endpoint, label=label, recursive=recursive)
|
|
280
287
|
|
|
281
288
|
# If a batch file is provided, read the file and add to delete data
|
|
@@ -47,6 +47,17 @@ def path_options(f):
|
|
|
47
47
|
)(f)
|
|
48
48
|
return f
|
|
49
49
|
|
|
50
|
+
def namespace_options(f):
|
|
51
|
+
f = click.option(
|
|
52
|
+
"--namespace",
|
|
53
|
+
"-ns",
|
|
54
|
+
type=str,
|
|
55
|
+
default="DEFAULT",
|
|
56
|
+
show_default=True,
|
|
57
|
+
help="Globus client namespace for the task or operation. Set to 'tacc' to view transfer tasks or operations to/from TACC.",
|
|
58
|
+
)(f)
|
|
59
|
+
return f
|
|
60
|
+
|
|
50
61
|
def valid_uuid(uuid):
|
|
51
62
|
regex = re.compile('^[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{12}\Z', re.I)
|
|
52
63
|
match = regex.match(uuid)
|
|
@@ -226,6 +237,7 @@ __all__ = (
|
|
|
226
237
|
"task_submission_options",
|
|
227
238
|
"endpoint_options",
|
|
228
239
|
"path_options",
|
|
240
|
+
"namespace_options",
|
|
229
241
|
"validate_dsid",
|
|
230
242
|
"valid_uuid",
|
|
231
243
|
"validate_endpoint",
|
{rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus/task_management.py
RENAMED
|
@@ -7,6 +7,7 @@ from globus_sdk import GlobusAPIError, NetworkError
|
|
|
7
7
|
|
|
8
8
|
from .lib import (
|
|
9
9
|
common_options,
|
|
10
|
+
namespace_options,
|
|
10
11
|
transfer_client,
|
|
11
12
|
colon_formatted_print,
|
|
12
13
|
print_table,
|
|
@@ -79,8 +80,9 @@ def _process_filterval(
|
|
|
79
80
|
"task-id",
|
|
80
81
|
type=click.UUID,
|
|
81
82
|
)
|
|
83
|
+
@namespace_options
|
|
82
84
|
@common_options
|
|
83
|
-
def get_task(task_id: uuid.UUID) -> None:
|
|
85
|
+
def get_task(task_id: uuid.UUID, namespace: str) -> None:
|
|
84
86
|
"""
|
|
85
87
|
Print information including status about a Globus task. The task may
|
|
86
88
|
be pending, completed, failed, or in progress.
|
|
@@ -88,7 +90,7 @@ def get_task(task_id: uuid.UUID) -> None:
|
|
|
88
90
|
if not task_id:
|
|
89
91
|
raise click.UsageError("TASK_ID is required.")
|
|
90
92
|
|
|
91
|
-
tc = transfer_client()
|
|
93
|
+
tc = transfer_client(namespace=namespace)
|
|
92
94
|
try:
|
|
93
95
|
task_info = tc.get_task(task_id)
|
|
94
96
|
except (GlobusAPIError, NetworkError) as e:
|
|
@@ -159,6 +161,7 @@ def get_task(task_id: uuid.UUID) -> None:
|
|
|
159
161
|
callback=_format_date_callback,
|
|
160
162
|
help="Filter tasks completed after this date.",
|
|
161
163
|
)
|
|
164
|
+
@namespace_options
|
|
162
165
|
@common_options
|
|
163
166
|
def task_list(
|
|
164
167
|
limit: int,
|
|
@@ -169,6 +172,7 @@ def task_list(
|
|
|
169
172
|
filter_requested_after: Union[str, None],
|
|
170
173
|
filter_completed_before: Union[str, None],
|
|
171
174
|
filter_completed_after: Union[str, None],
|
|
175
|
+
namespace: str
|
|
172
176
|
) -> None:
|
|
173
177
|
"""
|
|
174
178
|
List the most recent Globus tasks with optional filtering.
|
|
@@ -199,7 +203,7 @@ def task_list(
|
|
|
199
203
|
("Label", "label")
|
|
200
204
|
]
|
|
201
205
|
|
|
202
|
-
tc = transfer_client()
|
|
206
|
+
tc = transfer_client(namespace=namespace)
|
|
203
207
|
try:
|
|
204
208
|
tasks = tc.task_list(limit=limit, filter=filter_string, orderby="request_time DESC")
|
|
205
209
|
except (GlobusAPIError, NetworkError) as e:
|
|
@@ -208,6 +212,55 @@ def task_list(
|
|
|
208
212
|
|
|
209
213
|
print_table(tasks, fields)
|
|
210
214
|
|
|
215
|
+
@click.command(
|
|
216
|
+
help="List events and show details about a Globus task, including faults and error messages.",
|
|
217
|
+
)
|
|
218
|
+
@click.argument(
|
|
219
|
+
"task-id",
|
|
220
|
+
type=click.UUID,
|
|
221
|
+
)
|
|
222
|
+
@click.option(
|
|
223
|
+
"--limit",
|
|
224
|
+
"-l",
|
|
225
|
+
type=int,
|
|
226
|
+
default=None,
|
|
227
|
+
show_default=True,
|
|
228
|
+
help="Limit the number of results returned.",
|
|
229
|
+
)
|
|
230
|
+
@click.option(
|
|
231
|
+
"--offset",
|
|
232
|
+
"-o",
|
|
233
|
+
type=int,
|
|
234
|
+
default=None,
|
|
235
|
+
help="Offset used in pagination.",
|
|
236
|
+
)
|
|
237
|
+
@click.option(
|
|
238
|
+
"--error-only",
|
|
239
|
+
"-e",
|
|
240
|
+
is_flag=True,
|
|
241
|
+
help="Only show events with error codes.",
|
|
242
|
+
)
|
|
243
|
+
@namespace_options
|
|
244
|
+
@common_options
|
|
245
|
+
def task_event_list(task_id: uuid.UUID, limit: int, offset: int, error_only: bool, namespace: str) -> None:
|
|
246
|
+
"""
|
|
247
|
+
List the events associated with a Globus task. This includes status
|
|
248
|
+
updates, error messages, and other information about the task's progress.
|
|
249
|
+
"""
|
|
250
|
+
if not task_id:
|
|
251
|
+
raise click.UsageError("TASK_ID is required.")
|
|
252
|
+
|
|
253
|
+
tc = transfer_client(namespace=namespace)
|
|
254
|
+
try:
|
|
255
|
+
if error_only:
|
|
256
|
+
filters = {"filter": "is_error:1"}
|
|
257
|
+
for event in tc.task_event_list(task_id, limit=limit, offset=offset, query_params=filters):
|
|
258
|
+
print(f"Event on Task({task_id}) at {event['time']}:\n{event['code']}\n{event['description']}\n{event['details']}\n")
|
|
259
|
+
except (GlobusAPIError, NetworkError) as e:
|
|
260
|
+
logger.error(f"Error: {e}")
|
|
261
|
+
click.echo("Failed to get task events.")
|
|
262
|
+
return
|
|
263
|
+
|
|
211
264
|
@click.command(
|
|
212
265
|
help="Cancel a Globus task.",
|
|
213
266
|
)
|
|
@@ -215,8 +268,9 @@ def task_list(
|
|
|
215
268
|
"task-id",
|
|
216
269
|
type=click.UUID,
|
|
217
270
|
)
|
|
271
|
+
@namespace_options
|
|
218
272
|
@common_options
|
|
219
|
-
def cancel_task(task_id: uuid.UUID) -> None:
|
|
273
|
+
def cancel_task(task_id: uuid.UUID, namespace: str) -> None:
|
|
220
274
|
"""
|
|
221
275
|
Cancel a Globus task. This includes a task that is currently
|
|
222
276
|
executing or queued for execution.
|
|
@@ -224,7 +278,7 @@ def cancel_task(task_id: uuid.UUID) -> None:
|
|
|
224
278
|
if not task_id:
|
|
225
279
|
raise click.UsageError("TASK_ID is required.")
|
|
226
280
|
|
|
227
|
-
tc = transfer_client()
|
|
281
|
+
tc = transfer_client(namespace=namespace)
|
|
228
282
|
try:
|
|
229
283
|
res = tc.cancel_task(task_id)
|
|
230
284
|
click.echo(f"Task {task_id}\n{res['message']}")
|
|
@@ -236,4 +290,5 @@ def add_commands(group):
|
|
|
236
290
|
""" Add task management commands to a click group. """
|
|
237
291
|
group.add_command(get_task)
|
|
238
292
|
group.add_command(task_list)
|
|
293
|
+
group.add_command(task_event_list)
|
|
239
294
|
group.add_command(cancel_task)
|
{rda_python_globus-1.0.13 → rda_python_globus-1.0.17/src/rda_python_globus.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_globus
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.17
|
|
4
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/requires.txt
RENAMED
|
File without changes
|
{rda_python_globus-1.0.13 → rda_python_globus-1.0.17}/src/rda_python_globus.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|