pybiolib 1.1.1930__py3-none-any.whl → 1.1.1942__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.
- biolib/_internal/http_client.py +14 -5
- biolib/_internal/runtime.py +12 -0
- {pybiolib-1.1.1930.dist-info → pybiolib-1.1.1942.dist-info}/METADATA +1 -1
- {pybiolib-1.1.1930.dist-info → pybiolib-1.1.1942.dist-info}/RECORD +7 -7
- {pybiolib-1.1.1930.dist-info → pybiolib-1.1.1942.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.1930.dist-info → pybiolib-1.1.1942.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.1930.dist-info → pybiolib-1.1.1942.dist-info}/entry_points.txt +0 -0
biolib/_internal/http_client.py
CHANGED
@@ -94,7 +94,7 @@ class HttpClient:
|
|
94
94
|
if timeout_in_seconds is None:
|
95
95
|
timeout_in_seconds = 60 if isinstance(data, dict) else 180 # TODO: Calculate timeout based on data size
|
96
96
|
|
97
|
-
last_error: Optional[
|
97
|
+
last_error: Optional[Exception] = None
|
98
98
|
for retry_count in range(retries + 1):
|
99
99
|
if retry_count > 0:
|
100
100
|
time.sleep(5 * retry_count)
|
@@ -108,20 +108,29 @@ class HttpClient:
|
|
108
108
|
return HttpResponse(response, response_path)
|
109
109
|
|
110
110
|
except urllib.error.HTTPError as error:
|
111
|
-
if error.code ==
|
112
|
-
logger_no_user_data.
|
111
|
+
if error.code == 429:
|
112
|
+
logger_no_user_data.warning(f'HTTP {method} request failed with status 429 for "{url}"')
|
113
|
+
last_error = error
|
114
|
+
elif error.code == 502:
|
115
|
+
logger_no_user_data.warning(f'HTTP {method} request failed with status 502 for "{url}"')
|
113
116
|
last_error = error
|
114
117
|
elif error.code == 503:
|
115
|
-
logger_no_user_data.
|
118
|
+
logger_no_user_data.warning(f'HTTP {method} request failed with status 503 for "{url}"')
|
119
|
+
last_error = error
|
120
|
+
elif error.code == 504:
|
121
|
+
logger_no_user_data.warning(f'HTTP {method} request failed with status 504 for "{url}"')
|
116
122
|
last_error = error
|
117
123
|
else:
|
118
124
|
raise HttpError(error) from None
|
119
125
|
|
120
126
|
except urllib.error.URLError as error:
|
121
127
|
if isinstance(error.reason, socket.timeout):
|
122
|
-
logger_no_user_data.
|
128
|
+
logger_no_user_data.warning(f'HTTP {method} request failed with read timeout for "{url}"')
|
123
129
|
last_error = error
|
124
130
|
else:
|
125
131
|
raise error
|
132
|
+
except socket.timeout as error:
|
133
|
+
logger_no_user_data.warning(f'HTTP {method} request failed with read timeout for "{url}"')
|
134
|
+
last_error = error
|
126
135
|
|
127
136
|
raise last_error or Exception(f'HTTP {method} request failed after {retries} retries for "{url}"')
|
biolib/_internal/runtime.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import json
|
2
|
+
import re
|
2
3
|
|
3
4
|
from biolib import api
|
4
5
|
from biolib.typing_utils import Optional, TypedDict, cast
|
@@ -45,6 +46,17 @@ class Runtime:
|
|
45
46
|
def get_app_uri() -> str:
|
46
47
|
return Runtime._get_job_data()['app_uri']
|
47
48
|
|
49
|
+
@staticmethod
|
50
|
+
def get_secret(secret_name: str) -> bytes:
|
51
|
+
assert re.match(
|
52
|
+
'^[a-zA-Z0-9_-]*$', secret_name
|
53
|
+
), 'Secret name can only contain alphanumeric characters and dashes or underscores '
|
54
|
+
try:
|
55
|
+
with open(f'/biolib/secrets/{secret_name}', 'rb') as file:
|
56
|
+
return file.read()
|
57
|
+
except BaseException as error:
|
58
|
+
raise BioLibRuntimeError(f'Unable to get system secret: {secret_name}') from error
|
59
|
+
|
48
60
|
@staticmethod
|
49
61
|
def set_main_result_prefix(result_prefix: str) -> None:
|
50
62
|
job_data = Runtime._get_job_data()
|
@@ -5,9 +5,9 @@ biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
5
5
|
biolib/_internal/data_record/__init__.py,sha256=1Bk303i3rFet9veS56fIsrBYtT5X3n9vcsYMA6T6c5o,36
|
6
6
|
biolib/_internal/data_record/data_record.py,sha256=ctijrrZ-LfUxtwzS8PEVa1VBuBLVWEhmo2yHcEDkC0A,7178
|
7
7
|
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=LPq8Lr5FhKF9_o5K-bUdT7TeLe5XFUD0AAeTkNEVZug,1133
|
8
|
-
biolib/_internal/http_client.py,sha256=
|
8
|
+
biolib/_internal/http_client.py,sha256=DdooXei93JKGYGV4aQmzue_oFzvHkozg2UCxgk9dfDM,5081
|
9
9
|
biolib/_internal/push_application.py,sha256=H1PGNtVJ0vRC0li39gFMpPpjm6QeZ8Ob-7cLkLmxS_Y,10009
|
10
|
-
biolib/_internal/runtime.py,sha256=
|
10
|
+
biolib/_internal/runtime.py,sha256=BnFvRWYnxPXCgOtfxupN255Zxx9Gw6oPZyzUIGODw3k,3060
|
11
11
|
biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
|
12
12
|
biolib/api/__init__.py,sha256=iIO8ZRdn7YDhY5cR47-Wo1YsNOK8H6RN6jn8yor5WJI,137
|
13
13
|
biolib/api/client.py,sha256=MtDkH2Amr2Fko-bCR5DdookJu0yZ1q-6K_PPg4KK_Ek,2941
|
@@ -105,8 +105,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
105
105
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
106
106
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
107
107
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
108
|
-
pybiolib-1.1.
|
109
|
-
pybiolib-1.1.
|
110
|
-
pybiolib-1.1.
|
111
|
-
pybiolib-1.1.
|
112
|
-
pybiolib-1.1.
|
108
|
+
pybiolib-1.1.1942.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
109
|
+
pybiolib-1.1.1942.dist-info/METADATA,sha256=Pwe_8XEyKXVlgndcOctndELApx5t-8KLDuAc3EJFDis,1508
|
110
|
+
pybiolib-1.1.1942.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
111
|
+
pybiolib-1.1.1942.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
112
|
+
pybiolib-1.1.1942.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|