pybiolib 1.1.1990__py3-none-any.whl → 1.1.1998__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/data_record/remote_storage_endpoint.py +16 -5
- biolib/compute_node/remote_host_proxy.py +7 -0
- {pybiolib-1.1.1990.dist-info → pybiolib-1.1.1998.dist-info}/METADATA +1 -1
- {pybiolib-1.1.1990.dist-info → pybiolib-1.1.1998.dist-info}/RECORD +7 -7
- {pybiolib-1.1.1990.dist-info → pybiolib-1.1.1998.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.1990.dist-info → pybiolib-1.1.1998.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.1990.dist-info → pybiolib-1.1.1998.dist-info}/entry_points.txt +0 -0
@@ -1,23 +1,34 @@
|
|
1
|
+
import os
|
1
2
|
from datetime import datetime, timedelta
|
3
|
+
from urllib.parse import urlparse
|
2
4
|
|
3
5
|
from biolib.api import client as api_client
|
4
6
|
from biolib.biolib_api_client.lfs_types import LargeFileSystemVersion
|
5
7
|
from biolib.biolib_binary_format.utils import RemoteEndpoint
|
6
8
|
from biolib.biolib_logging import logger
|
9
|
+
from biolib.typing_utils import Optional
|
7
10
|
|
8
11
|
|
9
12
|
class DataRecordRemoteStorageEndpoint(RemoteEndpoint):
|
10
13
|
def __init__(self, resource_version_uuid: str):
|
11
14
|
self._resource_version_uuid: str = resource_version_uuid
|
12
|
-
self._expires_at = None
|
13
|
-
self._presigned_url = None
|
15
|
+
self._expires_at: Optional[datetime] = None
|
16
|
+
self._presigned_url: Optional[str] = None
|
14
17
|
|
15
|
-
def get_remote_url(self):
|
16
|
-
if not self._presigned_url or datetime.utcnow() > self._expires_at:
|
18
|
+
def get_remote_url(self) -> str:
|
19
|
+
if not self._presigned_url or not self._expires_at or datetime.utcnow() > self._expires_at:
|
17
20
|
lfs_version: LargeFileSystemVersion = api_client.get(
|
18
21
|
path=f'/lfs/versions/{self._resource_version_uuid}/',
|
19
22
|
).json()
|
20
|
-
|
23
|
+
|
24
|
+
app_caller_proxy_job_storage_base_url = os.getenv('BIOLIB_CLOUD_JOB_STORAGE_BASE_URL', '')
|
25
|
+
if app_caller_proxy_job_storage_base_url:
|
26
|
+
# Done to hit App Caller Proxy when downloading from inside an app
|
27
|
+
parsed_url = urlparse(lfs_version['presigned_download_url'])
|
28
|
+
self._presigned_url = f'{app_caller_proxy_job_storage_base_url}{parsed_url.path}?{parsed_url.query}'
|
29
|
+
else:
|
30
|
+
self._presigned_url = lfs_version['presigned_download_url']
|
31
|
+
|
21
32
|
self._expires_at = datetime.utcnow() + timedelta(minutes=8)
|
22
33
|
logger.debug(
|
23
34
|
f'DataRecord "{self._resource_version_uuid}" fetched presigned URL '
|
@@ -304,6 +304,13 @@ http {{
|
|
304
304
|
proxy_ssl_server_name on;
|
305
305
|
}}
|
306
306
|
|
307
|
+
location /api/app/ {{
|
308
|
+
proxy_pass {base_url}/api/app/;
|
309
|
+
proxy_set_header authorization {'$bearer_token_on_get' if self._can_access_all_data_records_of_user else '""'};
|
310
|
+
proxy_set_header cookie "";
|
311
|
+
proxy_ssl_server_name on;
|
312
|
+
}}
|
313
|
+
|
307
314
|
location /api/ {{
|
308
315
|
proxy_pass {base_url}/api/;
|
309
316
|
proxy_set_header authorization "";
|
@@ -4,7 +4,7 @@ biolib/__init__.py,sha256=nfZvVkrHZLvjvvlAvFzhvem9NMfqgmw8NWaCH9HGzew,4045
|
|
4
4
|
biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
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
|
-
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=
|
7
|
+
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=hILu0TmFx-ZyDYbWPC4QEPogP0RRVEqwgJc8OEHYp50,1742
|
8
8
|
biolib/_internal/fuse_mount/__init__.py,sha256=B_tM6RM2dBw-vbpoHJC4X3tOAaN1H2RDvqYJOw3xFwg,55
|
9
9
|
biolib/_internal/fuse_mount/experiment_fuse_mount.py,sha256=08aUdEq_bvqLBft_gSLjOClKDy5sBnMts1RfJf7AP_U,7012
|
10
10
|
biolib/_internal/http_client.py,sha256=DdooXei93JKGYGV4aQmzue_oFzvHkozg2UCxgk9dfDM,5081
|
@@ -75,7 +75,7 @@ biolib/compute_node/job_worker/large_file_system.py,sha256=XXqRlVtYhs-Ji9zQGIk5K
|
|
75
75
|
biolib/compute_node/job_worker/mappings.py,sha256=Z48Kg4nbcOvsT2-9o3RRikBkqflgO4XeaWxTGz-CNvI,2499
|
76
76
|
biolib/compute_node/job_worker/utilization_reporter_thread.py,sha256=7tm5Yk9coqJ9VbEdnO86tSXI0iM0omwIyKENxdxiVXk,8575
|
77
77
|
biolib/compute_node/job_worker/utils.py,sha256=wgxcIA8yAhUPdCwyvuuJ0JmreyWmmUoBO33vWtG60xg,1282
|
78
|
-
biolib/compute_node/remote_host_proxy.py,sha256=
|
78
|
+
biolib/compute_node/remote_host_proxy.py,sha256=BYmdw6LmyS0YouKsgAsoROX3__rVPantcJu1luIsm2Q,16352
|
79
79
|
biolib/compute_node/socker_listener_thread.py,sha256=T5_UikA3MB9bD5W_dckYLPTgixh72vKUlgbBvj9dbM0,1601
|
80
80
|
biolib/compute_node/socket_sender_thread.py,sha256=YgamPHeUm2GjMFGx8qk-99WlZhEs-kAb3q_2O6qByig,971
|
81
81
|
biolib/compute_node/utils.py,sha256=M7i_WTyxbFM3Lri9RWZ_8FeQNYrQIWpKGLfp2I55oeY,4677
|
@@ -109,8 +109,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
109
109
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
110
110
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
111
111
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
112
|
-
pybiolib-1.1.
|
113
|
-
pybiolib-1.1.
|
114
|
-
pybiolib-1.1.
|
115
|
-
pybiolib-1.1.
|
116
|
-
pybiolib-1.1.
|
112
|
+
pybiolib-1.1.1998.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.1998.dist-info/METADATA,sha256=3V8P0UEv5bTpOlVUAfNJAS7GQPCu2v_l7mu1Xqvr_sc,1508
|
114
|
+
pybiolib-1.1.1998.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.1998.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.1998.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|