accli 1.1.3__tar.gz → 1.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -4,6 +4,7 @@ import json
4
4
  import os
5
5
 
6
6
  import requests
7
+ from requests.adapters import HTTPAdapter
7
8
  import urllib3
8
9
  from typing import List, Tuple
9
10
 
@@ -21,7 +22,12 @@ class AccAPIError(Exception):
21
22
  self.status_code = status_code
22
23
 
23
24
 
24
- retries = urllib3.util.Retry(total=10, backoff_factor=1)
25
+ retries = urllib3.util.Retry(
26
+ total=10,
27
+ backoff_factor=1,
28
+ status_forcelist=[408, 429, 500, 502, 503, 504],
29
+ allowed_methods=["HEAD", "GET", "OPTIONS", "PUT"]
30
+ )
25
31
 
26
32
  http_client = urllib3.poolmanager.PoolManager(
27
33
  num_pools=20, retries=retries, maxsize=2000, block=True
@@ -41,8 +47,9 @@ class AcceleratorTerminalCliProjectService:
41
47
  ):
42
48
 
43
49
  self.user_token = user_token
50
+ self.verify_cert = verify_cert
44
51
 
45
- if verify_cert:
52
+ if self.verify_cert:
46
53
  self.http_client = http_client
47
54
  else:
48
55
  self.http_client = http_client_wo_cert_verification
@@ -264,16 +271,22 @@ class AcceleratorTerminalCliProjectService:
264
271
  project_slug, app_bucket_id, uniqified_filename, upload_id, part_number
265
272
  )
266
273
 
267
- part_upload_response = requests.put(
268
- put_presigned_url,
269
- data=part_data,
270
- # headers=headers,
271
- verify=False,
272
- )
274
+ session = requests.Session()
275
+ adapter = HTTPAdapter(max_retries=retries)
276
+ session.mount("https://", adapter)
277
+ session.verify = self.verify_cert
278
+
279
+ with session.put(
280
+ put_presigned_url,
281
+ data=part_data,
282
+ timeout=120
283
+ ) as part_upload_response:
284
+ part_upload_response.raise_for_status()
285
+
286
+ etag = part_upload_response.headers.get("etag").replace('"', "")
273
287
 
274
288
  progress.update(task, advance=len(part_data))
275
289
 
276
- etag = part_upload_response.headers.get("etag").replace('"', "")
277
290
  return part_number, etag
278
291
 
279
292
  def upload_filestream_to_accelerator(self, project_slug, filename, file_stream, progress, task,
@@ -1,3 +1,3 @@
1
1
  # Please strictly put double quote to use this info for git tag
2
2
  # Read a developer guide for git tag command with regex
3
- VERSION = "v1.1.3"
3
+ VERSION = "v1.1.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
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