NGPIris 5.4.2.dev3__py3-none-any.whl → 5.4.2.dev5__py3-none-any.whl

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/cli/__init__.py CHANGED
@@ -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")
NGPIris/hcp/hcp.py CHANGED
@@ -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
 
@@ -507,24 +507,39 @@ class HCPHandler:
507
507
  unit_scale = True,
508
508
  desc = local_file_path
509
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:
510
534
  self.s3_client.upload_file(
511
535
  Filename = local_file_path,
512
536
  Bucket = self.bucket_name,
513
537
  Key = key,
514
538
  Config = self.transfer_config,
515
- Callback = lambda bytes_transferred : pbar.update(bytes_transferred)
516
539
  )
517
- else:
518
- self.s3_client.upload_file(
519
- Filename = local_file_path,
520
- Bucket = self.bucket_name,
521
- Key = key,
522
- Config = self.transfer_config,
523
- )
524
-
525
540
 
526
541
  @check_mounted
527
- 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:
528
543
  """
529
544
  Upload the contents of a folder to the mounted bucket
530
545
 
@@ -544,7 +559,12 @@ class HCPHandler:
544
559
  filenames = listdir(local_folder_path)
545
560
 
546
561
  for filename in filenames:
547
- self.upload_file(local_folder_path + filename, key + filename, show_progress_bar = show_progress_bar)
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
+ )
548
568
 
549
569
  @check_mounted
550
570
  def delete_objects(self, keys : list[str], verbose : bool = True) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NGPIris
3
- Version: 5.4.2.dev3
3
+ Version: 5.4.2.dev5
4
4
  Author-email: Erik Brink <erik.brink@gu.se>, Isak Sylvin <isak.sylvin@gu.se>
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,21 +1,21 @@
1
1
  NGPIris/__init__.py,sha256=eHaeRGl1JQ_hjsazEd4oQCXOkdpSxLIzg-ipYAAaa-s,69
2
- NGPIris/cli/__init__.py,sha256=yZsTn2noSZTmg1BWPKwTklGTEIqMCIse4vZVN1TORaY,14459
2
+ NGPIris/cli/__init__.py,sha256=rcgGblfHzHbbbW4HLMHRXFCyHQ4Bl4AyRNmkL3MpZ18,14739
3
3
  NGPIris/hci/__init__.py,sha256=qZRzN2JZp8uIw46TQiqJHMIkleiVDErSoZ3-v0O_cZU,38
4
4
  NGPIris/hci/exceptions.py,sha256=wUbpUwY8u1QtuSvnzlBuql9LgGsxBl207IGsHkCt-JQ,47
5
5
  NGPIris/hci/hci.py,sha256=-7RBWPGqlINVNsl-GbjuXkcLdIF5cs4cu3OFt2FJi1E,4321
6
6
  NGPIris/hci/helpers.py,sha256=THZt9ItmEsEiuvB1v99orAx1oOMgBdGR62PQyOre5yo,2592
7
7
  NGPIris/hcp/__init__.py,sha256=yMDW3WpxsU89GNcBJ3ApeGHOmWvisfuuAsZxwlKWnpw,38
8
8
  NGPIris/hcp/exceptions.py,sha256=24irbs3JMWaVOM_gf4ByR1hfYPpEP1eXPgHvq77uuqU,361
9
- NGPIris/hcp/hcp.py,sha256=ZGUSrpo9hLHrKWIBXstdUxKm6SZrmzqq4G7PWLmNamo,30618
9
+ NGPIris/hcp/hcp.py,sha256=OM2BfAvCKb0poGEl73Eqop5z4gOm4k9eLMNsEC6hPp8,31608
10
10
  NGPIris/hcp/helpers.py,sha256=SRHX-B6TSDogK7Mz2co7VkzHtZdtMaMeH-_NoDWEDh8,1406
11
11
  NGPIris/hcp/statistics.py,sha256=8VgRC-7hWQOCRWwoKk4NHCtGTdY_4C2iHcAHEXKJ0kM,817
12
12
  NGPIris/parse_credentials/__init__.py,sha256=O9uq_F9uOtuW7giW-t10KV4VmTgfkvgaBEwQU43Sf-w,57
13
13
  NGPIris/parse_credentials/parse_credentials.py,sha256=E1NzQCMvjOa2mGLBkEYshZomNSxfSCkoc_iUhUfpBEM,2106
14
14
  NGPIris/utils/__init__.py,sha256=yPCEc1-_7r01dZ-31EKiA7Jova7ztX7XXuU95IKmKX8,59
15
15
  NGPIris/utils/utils.py,sha256=m9qwLuOoiqVNRy7B4raYNFJkigL_wE--PiWhyhVhHII,248
16
- ngpiris-5.4.2.dev3.dist-info/licenses/LICENSE,sha256=ZA2Q9u5AEkH_YoNNDRsz-DBJ6ZuL_foE7RsKFjXd4-c,18093
17
- ngpiris-5.4.2.dev3.dist-info/METADATA,sha256=Enz165Hot9u9r6c0e5OwwX_zCz5JgRFASMvYl8nbLT8,7102
18
- ngpiris-5.4.2.dev3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
- ngpiris-5.4.2.dev3.dist-info/entry_points.txt,sha256=t8ADhe3ovPm9tW3XDZq1_vKmfHY98Ei_o6WioJobNzU,117
20
- ngpiris-5.4.2.dev3.dist-info/top_level.txt,sha256=954WCuIJkle_SMtr7MNPapiiLLAFhlKbcz6Bp89-2V0,8
21
- ngpiris-5.4.2.dev3.dist-info/RECORD,,
16
+ ngpiris-5.4.2.dev5.dist-info/licenses/LICENSE,sha256=ZA2Q9u5AEkH_YoNNDRsz-DBJ6ZuL_foE7RsKFjXd4-c,18093
17
+ ngpiris-5.4.2.dev5.dist-info/METADATA,sha256=g-9KNTkJ8VW7mXfkgYFBveioaGEp5qS81WxEzSB9jlI,7102
18
+ ngpiris-5.4.2.dev5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ ngpiris-5.4.2.dev5.dist-info/entry_points.txt,sha256=t8ADhe3ovPm9tW3XDZq1_vKmfHY98Ei_o6WioJobNzU,117
20
+ ngpiris-5.4.2.dev5.dist-info/top_level.txt,sha256=954WCuIJkle_SMtr7MNPapiiLLAFhlKbcz6Bp89-2V0,8
21
+ ngpiris-5.4.2.dev5.dist-info/RECORD,,