pybiolib 1.1.1437__py3-none-any.whl → 1.1.1445__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/api/client.py +3 -3
- biolib/biolib_api_client/auth.py +4 -17
- biolib/jobs/job.py +15 -9
- {pybiolib-1.1.1437.dist-info → pybiolib-1.1.1445.dist-info}/METADATA +1 -1
- {pybiolib-1.1.1437.dist-info → pybiolib-1.1.1445.dist-info}/RECORD +8 -8
- {pybiolib-1.1.1437.dist-info → pybiolib-1.1.1445.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.1437.dist-info → pybiolib-1.1.1445.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.1437.dist-info → pybiolib-1.1.1445.dist-info}/entry_points.txt +0 -0
biolib/api/client.py
CHANGED
@@ -56,7 +56,6 @@ class ApiClient:
|
|
56
56
|
) -> BioLibHTTPResponse:
|
57
57
|
url = self._get_absolute_url(path, query_params=params)
|
58
58
|
req = urllib.request.Request(url, headers=self._get_headers(headers, authenticate))
|
59
|
-
|
60
59
|
retries = 10
|
61
60
|
for retry_count in range(retries):
|
62
61
|
if retry_count > 0:
|
@@ -74,12 +73,13 @@ class ApiClient:
|
|
74
73
|
|
75
74
|
except urllib.error.URLError as error:
|
76
75
|
if isinstance(error.reason, socket.timeout):
|
77
|
-
logger_no_user_data.debug(f'HTTP
|
76
|
+
logger_no_user_data.debug(f'HTTP GET request failed with read timeout for "{path}"')
|
78
77
|
continue
|
79
78
|
|
80
79
|
raise Exception(f'HTTP GET request failed after {retries} retries for "{url}"')
|
81
80
|
|
82
|
-
def post(self, path: str, data: Union[Dict, bytes]
|
81
|
+
def post(self, path: str, data: Optional[Union[Dict, bytes]] = None,
|
82
|
+
headers: OptionalHeaders = None) -> BioLibHTTPResponse:
|
83
83
|
retries = 3
|
84
84
|
for retry_count in range(retries):
|
85
85
|
if retry_count > 0:
|
biolib/biolib_api_client/auth.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
import requests
|
2
1
|
from requests.auth import AuthBase # type: ignore
|
3
2
|
|
4
|
-
from biolib
|
3
|
+
from biolib import api
|
5
4
|
from biolib.biolib_api_client.api_client import UserTokens
|
6
|
-
from biolib.biolib_errors import BioLibError
|
7
5
|
from biolib.typing_utils import TypedDict, Literal
|
8
6
|
|
9
7
|
|
@@ -33,27 +31,16 @@ class BiolibAuthChallengeApi:
|
|
33
31
|
|
34
32
|
@staticmethod
|
35
33
|
def create_auth_challenge() -> AuthChallengeCreate:
|
36
|
-
response =
|
37
|
-
url=f'{BiolibApiClient.get().base_url}/api/user/auth_challenges/',
|
38
|
-
timeout=5,
|
39
|
-
)
|
40
|
-
|
41
|
-
if not response.ok:
|
42
|
-
raise BioLibError(response.content.decode())
|
43
|
-
|
34
|
+
response = api._client.post(path='/user/auth_challenges/') # pylint: disable=protected-access
|
44
35
|
response_dict: AuthChallengeCreate = response.json()
|
45
36
|
return response_dict
|
46
37
|
|
47
38
|
@staticmethod
|
48
39
|
def get_auth_challenge_status(token: str) -> AuthChallengeStatus:
|
49
|
-
response =
|
50
|
-
|
40
|
+
response = api._client.get( # pylint: disable=protected-access
|
41
|
+
path='/user/auth_challenges/',
|
51
42
|
headers={'Auth-Challenge-Token': token},
|
52
|
-
timeout=5,
|
53
43
|
)
|
54
44
|
|
55
|
-
if not response.ok:
|
56
|
-
raise BioLibError(response.content.decode())
|
57
|
-
|
58
45
|
response_dict: AuthChallengeStatus = response.json()
|
59
46
|
return response_dict
|
biolib/jobs/job.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import base64
|
2
|
+
import urllib.request
|
2
3
|
from datetime import datetime, timedelta
|
3
4
|
import sys
|
4
5
|
import time
|
@@ -8,6 +9,7 @@ from urllib.parse import urlparse
|
|
8
9
|
|
9
10
|
import requests
|
10
11
|
from biolib import api, utils
|
12
|
+
from biolib.api.client import BioLibHTTPResponse
|
11
13
|
from biolib.biolib_api_client.biolib_job_api import BiolibJobApi
|
12
14
|
from biolib.biolib_binary_format import LazyLoadedFile, ModuleOutputV2, ModuleInput, ModuleInputDict
|
13
15
|
from biolib.biolib_binary_format.stdout_and_stderr import StdoutAndStderr
|
@@ -298,17 +300,20 @@ class Job:
|
|
298
300
|
|
299
301
|
def _print_full_logs(self, node_url: str) -> None:
|
300
302
|
try:
|
301
|
-
|
302
|
-
|
303
|
-
|
303
|
+
req = urllib.request.Request(f'{node_url}/v1/job/{self._uuid}/status/?logs=full')
|
304
|
+
with urllib.request.urlopen(req, timeout=60) as response:
|
305
|
+
biolib_http_response = BioLibHTTPResponse(response)
|
306
|
+
biolib_http_response.raise_for_status()
|
307
|
+
response_json = biolib_http_response.json()
|
308
|
+
|
304
309
|
except Exception as error:
|
305
310
|
logger.error(f'Could not get full streamed logs due to: {error}')
|
306
311
|
raise BioLibError from error
|
307
312
|
|
308
|
-
for status_update in
|
313
|
+
for status_update in response_json.get('previous_status_updates', []):
|
309
314
|
logger.info(f'Cloud: {status_update["log_message"]}')
|
310
315
|
|
311
|
-
self.print_logs_packages(
|
316
|
+
self.print_logs_packages(response_json['streamed_logs_packages_b64'])
|
312
317
|
|
313
318
|
def _get_cloud_job_awaiting_started(self) -> CloudJobStartedDict:
|
314
319
|
while True:
|
@@ -329,10 +334,11 @@ class Job:
|
|
329
334
|
def _get_job_status_from_compute_node(self, compute_node_url):
|
330
335
|
for _ in range(15):
|
331
336
|
try:
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
337
|
+
req = urllib.request.Request(f'{compute_node_url}/v1/job/{self._uuid}/status/')
|
338
|
+
with urllib.request.urlopen(req, timeout=60) as response:
|
339
|
+
biolib_http_response = BioLibHTTPResponse(response)
|
340
|
+
biolib_http_response.raise_for_status()
|
341
|
+
return biolib_http_response.json()
|
336
342
|
|
337
343
|
except Exception: # pylint: disable=broad-except
|
338
344
|
cloud_job = self._get_cloud_job()
|
@@ -2,14 +2,14 @@ LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
|
2
2
|
README.md,sha256=_IH7pxFiqy2bIAmaVeA-iVTyUwWRjMIlfgtUbYTtmls,368
|
3
3
|
biolib/__init__.py,sha256=yoQA2fWt8aToFas3sx6UIoFBW7-dd2yf7Nyi5smQl88,3418
|
4
4
|
biolib/api/__init__.py,sha256=fhsbqVxDYfQ2NMYKkFW-msplAa1YPllfKEkAtLdD9IM,95
|
5
|
-
biolib/api/client.py,sha256=
|
5
|
+
biolib/api/client.py,sha256=9z__FvXvwqYgjvesHyZxD8QGD3veAnaEYOZ1WKWsLvo,6279
|
6
6
|
biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
|
7
7
|
biolib/app/app.py,sha256=6V_36uqwiC5ERtv2wU7J3KxbV9dKxMlKugx15ylSsTY,10186
|
8
8
|
biolib/app/search_apps.py,sha256=CIanvDebNpMtWck0w4IoR_tRZ6LpSWC8DPxXW2e6Ww4,1495
|
9
9
|
biolib/biolib_api_client/__init__.py,sha256=E5EMa19wJoblwSdQPYrxc_BtIeRsAuO0L_jQweWw-Yk,182
|
10
10
|
biolib/biolib_api_client/api_client.py,sha256=4H1lFXWTm-MGmgP8wEHWWzLH_YGnCVx1aQJX0H2PFDg,7092
|
11
11
|
biolib/biolib_api_client/app_types.py,sha256=vEjkpMwaMfz8MxBBZQfWCkxqT7NXxWocB_Oe9WHjJ_g,2425
|
12
|
-
biolib/biolib_api_client/auth.py,sha256=
|
12
|
+
biolib/biolib_api_client/auth.py,sha256=eR1DhaijmiL7pKKxNGsHL4g5AZwBqgMrJLpUzoskLDU,1341
|
13
13
|
biolib/biolib_api_client/biolib_account_api.py,sha256=2Mc6SbmjBSsz8lF2H3iiaZHEm47LyI0B4rjmvzxKHt4,580
|
14
14
|
biolib/biolib_api_client/biolib_app_api.py,sha256=qYUSTyVxCCidNCX7xIQlaQ6vyGLkx1O7PXSxPltlUgA,3793
|
15
15
|
biolib/biolib_api_client/biolib_job_api.py,sha256=EBtKdfe8wrU5ZoiZ8KxtBKCwxq4gAuU6zwxN8r4NikA,7860
|
@@ -76,7 +76,7 @@ biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
76
76
|
biolib/experiments/experiment.py,sha256=xUd3LkV5ztFIjTx_ehBu8e-flvfuQnYimFtPj1upzb0,5942
|
77
77
|
biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
|
78
78
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
79
|
-
biolib/jobs/job.py,sha256=
|
79
|
+
biolib/jobs/job.py,sha256=5sGXJ5yJL1ywg-OMMtUIEdvvWXW6MOYntlOOPec5wUg,15290
|
80
80
|
biolib/jobs/job_result.py,sha256=8GasUmUXD8SjUYrE2N-HrDx7-AI6TEkFONH8H91t01Q,4913
|
81
81
|
biolib/jobs/types.py,sha256=kn4Vc0fDi6jFVcjpcKH6AYFKXkVA_CaRvtmsJoSyr0c,905
|
82
82
|
biolib/lfs/__init__.py,sha256=wspftSqe_x7xPMZbeW8mcIBuxbHFCiFI3V4TuZU4nZ4,193
|
@@ -96,8 +96,8 @@ biolib/utils/cache_state.py,sha256=BFrZlV4XZIueIFzAFiPidX4hmwADKY5Y5ZuqlerF5l0,3
|
|
96
96
|
biolib/utils/multipart_uploader.py,sha256=Bf09MJcIOBwzG8L1i5UeQ2cNcYohxklhhWWAMpnE41I,9671
|
97
97
|
biolib/utils/seq_util.py,sha256=QRLYIPg1yM_LF9bFuM-Ow14gTHoG3rOK6CeGHD705qw,2612
|
98
98
|
biolib/utils/zip/remote_zip.py,sha256=NCdUnVbGCv7SfXCI-yVU-is_OnyWmLAnVpIdSvo-W4k,23500
|
99
|
-
pybiolib-1.1.
|
100
|
-
pybiolib-1.1.
|
101
|
-
pybiolib-1.1.
|
102
|
-
pybiolib-1.1.
|
103
|
-
pybiolib-1.1.
|
99
|
+
pybiolib-1.1.1445.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
100
|
+
pybiolib-1.1.1445.dist-info/METADATA,sha256=DRlu0hb5CL798tkSRbozD7W_lKGNr-iRJICvkTBR5s0,1492
|
101
|
+
pybiolib-1.1.1445.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
102
|
+
pybiolib-1.1.1445.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
103
|
+
pybiolib-1.1.1445.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|