NGPIris 5.4.2.dev4__tar.gz → 5.4.2.dev5__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.
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/cli/__init__.py +9 -3
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hcp/hcp.py +34 -16
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5/NGPIris.egg-info}/PKG-INFO +1 -1
- {ngpiris-5.4.2.dev4/NGPIris.egg-info → ngpiris-5.4.2.dev5}/PKG-INFO +1 -1
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/pyproject.toml +1 -1
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/LICENSE +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/MANIFEST.in +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/__init__.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hci/__init__.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hci/exceptions.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hci/hci.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hci/helpers.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hcp/__init__.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hcp/exceptions.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hcp/helpers.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/hcp/statistics.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/parse_credentials/__init__.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/parse_credentials/parse_credentials.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/utils/__init__.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris/utils/utils.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris.egg-info/SOURCES.txt +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris.egg-info/dependency_links.txt +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris.egg-info/entry_points.txt +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris.egg-info/requires.txt +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/NGPIris.egg-info/top_level.txt +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/README.md +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/IRIS_5_changelog.md +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/Makefile +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/NGPIris.cli.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/NGPIris.hci.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/NGPIris.hcp.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/NGPIris.parse_credentials.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/NGPIris.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/NGPIris.utils.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/Tutorial.md +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/conf.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/index.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/make.bat +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/docs/modules.rst +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/setup.cfg +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/80MB_test_file +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/a folder of data/80MB_test_file_0 +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/a folder of data/80MB_test_file_1 +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/complete_creds_0.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/complete_creds_1.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/complete_creds_2.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/incomplete_creds_0.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/incomplete_creds_1.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/incomplete_creds_2.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/incomplete_creds_3.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/data/incomplete_creds_4.json +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/test_hci.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/test_hcp.py +0 -0
- {ngpiris-5.4.2.dev4 → ngpiris-5.4.2.dev5}/tests/test_parse_credentials.py +0 -0
|
@@ -78,8 +78,14 @@ def cli(context : Context, credentials : str, debug : bool, transfer_config : st
|
|
|
78
78
|
help = "Simulate the command execution without making actual changes. Useful for testing and verification",
|
|
79
79
|
is_flag = True
|
|
80
80
|
)
|
|
81
|
+
@click.option(
|
|
82
|
+
"-su",
|
|
83
|
+
"--simple_upload",
|
|
84
|
+
help = "Use an upload method that does not use mulitpart. Usefull for times when multipart upload misbehaves",
|
|
85
|
+
is_flag = True
|
|
86
|
+
)
|
|
81
87
|
@click.pass_context
|
|
82
|
-
def upload(context : Context, bucket : str, source : str, destination : str, dry_run : bool):
|
|
88
|
+
def upload(context : Context, bucket : str, source : str, destination : str, dry_run : bool, simple_upload : bool):
|
|
83
89
|
"""
|
|
84
90
|
Upload files to an HCP bucket/namespace.
|
|
85
91
|
|
|
@@ -97,14 +103,14 @@ def upload(context : Context, bucket : str, source : str, destination : str, dry
|
|
|
97
103
|
if dry_run:
|
|
98
104
|
click.echo("This command would have uploaded the folder \"" + source + "\" to \"" + destination + "\"")
|
|
99
105
|
else:
|
|
100
|
-
hcph.upload_folder(source, destination)
|
|
106
|
+
hcph.upload_folder(source, destination, use_simple_upload = simple_upload)
|
|
101
107
|
else:
|
|
102
108
|
file_name = Path(source).name
|
|
103
109
|
destination += file_name
|
|
104
110
|
if dry_run:
|
|
105
111
|
click.echo("This command would have uploaded the file \"" + source + "\" to \"" + destination + "\"")
|
|
106
112
|
else:
|
|
107
|
-
hcph.upload_file(source, destination)
|
|
113
|
+
hcph.upload_file(source, destination, use_simple_upload = simple_upload)
|
|
108
114
|
|
|
109
115
|
@cli.command()
|
|
110
116
|
@click.argument("bucket")
|
|
@@ -470,7 +470,7 @@ class HCPHandler:
|
|
|
470
470
|
raise NotADirectory(local_folder_path + " is not a directory")
|
|
471
471
|
|
|
472
472
|
@check_mounted
|
|
473
|
-
def upload_file(self, local_file_path : str, key : str = "", show_progress_bar : bool = True) -> None:
|
|
473
|
+
def upload_file(self, local_file_path : str, key : str = "", show_progress_bar : bool = True, use_simple_upload : bool = False) -> None:
|
|
474
474
|
"""
|
|
475
475
|
Upload one file to the mounted bucket
|
|
476
476
|
|
|
@@ -496,10 +496,8 @@ class HCPHandler:
|
|
|
496
496
|
if "\\" in local_file_path:
|
|
497
497
|
raise RuntimeError("The \"\\\" character is not allowed in the file path")
|
|
498
498
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if False:
|
|
502
|
-
pass
|
|
499
|
+
if self.object_exists(key):
|
|
500
|
+
raise ObjectAlreadyExist("The object \"" + key + "\" already exist in the mounted bucket")
|
|
503
501
|
else:
|
|
504
502
|
if show_progress_bar:
|
|
505
503
|
file_size : int = stat(local_file_path).st_size
|
|
@@ -509,24 +507,39 @@ class HCPHandler:
|
|
|
509
507
|
unit_scale = True,
|
|
510
508
|
desc = local_file_path
|
|
511
509
|
) as pbar:
|
|
510
|
+
if use_simple_upload:
|
|
511
|
+
self.s3_client.upload_file(
|
|
512
|
+
Filename = local_file_path,
|
|
513
|
+
Bucket = self.bucket_name,
|
|
514
|
+
Key = key,
|
|
515
|
+
Config = TransferConfig(multipart_chunksize = file_size),
|
|
516
|
+
Callback = lambda bytes_transferred : pbar.update(bytes_transferred)
|
|
517
|
+
)
|
|
518
|
+
else:
|
|
519
|
+
self.s3_client.upload_file(
|
|
520
|
+
Filename = local_file_path,
|
|
521
|
+
Bucket = self.bucket_name,
|
|
522
|
+
Key = key,
|
|
523
|
+
Config = self.transfer_config,
|
|
524
|
+
Callback = lambda bytes_transferred : pbar.update(bytes_transferred)
|
|
525
|
+
)
|
|
526
|
+
else:
|
|
527
|
+
if use_simple_upload:
|
|
528
|
+
self.s3_client.upload_file(
|
|
529
|
+
Filename = local_file_path,
|
|
530
|
+
Bucket = self.bucket_name,
|
|
531
|
+
Key = key,
|
|
532
|
+
)
|
|
533
|
+
else:
|
|
512
534
|
self.s3_client.upload_file(
|
|
513
535
|
Filename = local_file_path,
|
|
514
536
|
Bucket = self.bucket_name,
|
|
515
537
|
Key = key,
|
|
516
538
|
Config = self.transfer_config,
|
|
517
|
-
Callback = lambda bytes_transferred : pbar.update(bytes_transferred)
|
|
518
539
|
)
|
|
519
|
-
else:
|
|
520
|
-
self.s3_client.upload_file(
|
|
521
|
-
Filename = local_file_path,
|
|
522
|
-
Bucket = self.bucket_name,
|
|
523
|
-
Key = key,
|
|
524
|
-
Config = self.transfer_config,
|
|
525
|
-
)
|
|
526
|
-
|
|
527
540
|
|
|
528
541
|
@check_mounted
|
|
529
|
-
def upload_folder(self, local_folder_path : str, key : str = "", show_progress_bar : bool = True) -> None:
|
|
542
|
+
def upload_folder(self, local_folder_path : str, key : str = "", show_progress_bar : bool = True, use_simple_upload : bool = False) -> None:
|
|
530
543
|
"""
|
|
531
544
|
Upload the contents of a folder to the mounted bucket
|
|
532
545
|
|
|
@@ -546,7 +559,12 @@ class HCPHandler:
|
|
|
546
559
|
filenames = listdir(local_folder_path)
|
|
547
560
|
|
|
548
561
|
for filename in filenames:
|
|
549
|
-
self.upload_file(
|
|
562
|
+
self.upload_file(
|
|
563
|
+
local_folder_path + filename,
|
|
564
|
+
key + filename,
|
|
565
|
+
show_progress_bar = show_progress_bar,
|
|
566
|
+
use_simple_upload = use_simple_upload
|
|
567
|
+
)
|
|
550
568
|
|
|
551
569
|
@check_mounted
|
|
552
570
|
def delete_objects(self, keys : list[str], verbose : bool = True) -> None:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|