pybiolib 1.1.1923__py3-none-any.whl → 1.1.1928__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/runtime.py +6 -0
- biolib/compute_node/remote_host_proxy.py +37 -29
- {pybiolib-1.1.1923.dist-info → pybiolib-1.1.1928.dist-info}/METADATA +1 -1
- {pybiolib-1.1.1923.dist-info → pybiolib-1.1.1928.dist-info}/RECORD +7 -7
- {pybiolib-1.1.1923.dist-info → pybiolib-1.1.1928.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.1923.dist-info → pybiolib-1.1.1928.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.1923.dist-info → pybiolib-1.1.1928.dist-info}/entry_points.txt +0 -0
biolib/_internal/runtime.py
CHANGED
@@ -54,6 +54,12 @@ class Runtime:
|
|
54
54
|
path=f"/jobs/{job_data['job_uuid']}/main_result/",
|
55
55
|
)
|
56
56
|
|
57
|
+
@staticmethod
|
58
|
+
def create_result_note(note: str) -> None:
|
59
|
+
job_id = Runtime.get_job_id()
|
60
|
+
# Note: Authentication is added by app caller proxy in compute node
|
61
|
+
api.client.post(data={'note': note}, path=f'/jobs/{job_id}/notes/')
|
62
|
+
|
57
63
|
@staticmethod
|
58
64
|
def _try_to_get_job_data() -> Optional[RuntimeJobDataDict]:
|
59
65
|
if not Runtime._job_data:
|
@@ -1,21 +1,20 @@
|
|
1
1
|
import io
|
2
|
-
import tarfile
|
3
2
|
import subprocess
|
3
|
+
import tarfile
|
4
4
|
import time
|
5
5
|
|
6
|
-
from docker.models.containers import Container # type: ignore
|
7
6
|
from docker.errors import ImageNotFound # type: ignore
|
7
|
+
from docker.models.containers import Container # type: ignore
|
8
8
|
from docker.models.images import Image # type: ignore
|
9
9
|
from docker.models.networks import Network # type: ignore
|
10
10
|
|
11
11
|
from biolib import utils
|
12
|
-
from biolib.
|
13
|
-
from biolib.compute_node.cloud_utils import CloudUtils
|
14
|
-
from biolib.typing_utils import Optional, List
|
15
|
-
from biolib.biolib_api_client import RemoteHost
|
12
|
+
from biolib.biolib_api_client import BiolibApiClient, RemoteHost
|
16
13
|
from biolib.biolib_docker_client import BiolibDockerClient
|
14
|
+
from biolib.biolib_errors import BioLibError
|
17
15
|
from biolib.biolib_logging import logger_no_user_data
|
18
|
-
from biolib.
|
16
|
+
from biolib.compute_node.cloud_utils import CloudUtils
|
17
|
+
from biolib.typing_utils import List, Optional
|
19
18
|
|
20
19
|
|
21
20
|
# Prepare for remote hosts with specified port
|
@@ -24,31 +23,25 @@ class RemoteHostExtended(RemoteHost):
|
|
24
23
|
|
25
24
|
|
26
25
|
class RemoteHostProxy:
|
27
|
-
|
28
26
|
def __init__(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
self,
|
28
|
+
remote_host: RemoteHost,
|
29
|
+
public_network: Network,
|
30
|
+
internal_network: Optional[Network],
|
31
|
+
job_id: str,
|
32
|
+
ports: List[int],
|
33
|
+
can_push_data_record_for_user: bool,
|
36
34
|
):
|
37
35
|
self._can_push_data_record_for_user: bool = can_push_data_record_for_user
|
38
36
|
self.is_app_caller_proxy = remote_host['hostname'] == 'AppCallerProxy'
|
39
|
-
|
40
|
-
# Default to port 443 for now until backend serves remote_hosts with port specified
|
41
|
-
self._remote_host: RemoteHostExtended = RemoteHostExtended(
|
42
|
-
hostname=remote_host['hostname'],
|
43
|
-
ports=ports
|
44
|
-
)
|
37
|
+
self._remote_host: RemoteHostExtended = RemoteHostExtended(hostname=remote_host['hostname'], ports=ports)
|
45
38
|
self._public_network: Network = public_network
|
46
39
|
self._internal_network: Optional[Network] = internal_network
|
47
40
|
|
48
41
|
if not job_id:
|
49
42
|
raise Exception('RemoteHostProxy missing argument "job_id"')
|
50
43
|
|
51
|
-
self._name = f
|
44
|
+
self._name = f'biolib-remote-host-proxy-{job_id}-{self.hostname}'
|
52
45
|
self._job_uuid = job_id
|
53
46
|
self._container: Optional[Container] = None
|
54
47
|
self._enclave_traffic_forwarder_processes: List[subprocess.Popen] = []
|
@@ -165,15 +158,19 @@ class RemoteHostProxy:
|
|
165
158
|
else:
|
166
159
|
raise BioLibError('Calling apps inside apps is not supported in local compute environment')
|
167
160
|
|
161
|
+
compute_node_uuid: Optional[str] = None
|
162
|
+
compute_node_auth_token: Optional[str] = None
|
168
163
|
if utils.IS_RUNNING_IN_CLOUD:
|
169
164
|
config = CloudUtils.get_webserver_config()
|
165
|
+
compute_node_uuid = config['compute_node_info']['public_id']
|
166
|
+
compute_node_auth_token = config['compute_node_info']['auth_token']
|
170
167
|
s3_results_bucket_name = config['s3_general_storage_bucket_name']
|
171
168
|
s3_results_base_url = f'https://{s3_results_bucket_name}.s3.amazonaws.com'
|
172
169
|
else:
|
173
170
|
if base_url in ('https://biolib.com', 'https://staging-elb.biolib.com'):
|
174
171
|
s3_results_base_url = 'https://biolib-cloud-api.s3.amazonaws.com'
|
175
172
|
else:
|
176
|
-
raise BioLibError(
|
173
|
+
raise BioLibError('Calling apps inside apps locally is only supported on biolib.com')
|
177
174
|
|
178
175
|
# TODO: Get access_token from new API class instead
|
179
176
|
access_token = BiolibApiClient.get().access_token
|
@@ -287,6 +284,17 @@ http {{
|
|
287
284
|
proxy_ssl_server_name on;
|
288
285
|
}}
|
289
286
|
|
287
|
+
location ~ "^/api/jobs/{self._job_uuid}/notes/$" {{
|
288
|
+
# Note: Using $1 here as URI part from regex must be used for proxy_pass
|
289
|
+
proxy_pass {base_url}/api/{self._job_uuid}/notes/$1;
|
290
|
+
proxy_set_header authorization "";
|
291
|
+
proxy_set_header job-auth-token "";
|
292
|
+
proxy_set_header compute-node-auth-token "{compute_node_auth_token}";
|
293
|
+
proxy_set_header compute-node-uuid "{compute_node_uuid}";
|
294
|
+
proxy_set_header cookie "";
|
295
|
+
proxy_ssl_server_name on;
|
296
|
+
}}
|
297
|
+
|
290
298
|
location /api/lfs/ {{
|
291
299
|
proxy_pass {base_url}/api/lfs/;
|
292
300
|
proxy_set_header authorization {'$bearer_token_on_post_and_get' if self._can_push_data_record_for_user else '""'};
|
@@ -345,13 +353,13 @@ http {{
|
|
345
353
|
}}
|
346
354
|
'''
|
347
355
|
else:
|
348
|
-
nginx_config =
|
356
|
+
nginx_config = """
|
349
357
|
events {}
|
350
358
|
error_log /dev/stdout info;
|
351
359
|
stream {
|
352
|
-
resolver 127.0.0.11 valid=30s;
|
360
|
+
resolver 127.0.0.11 valid=30s;"""
|
353
361
|
for idx, upstream_server_port in enumerate(upstream_server_ports):
|
354
|
-
nginx_config += f
|
362
|
+
nginx_config += f"""
|
355
363
|
map "" $upstream_{idx} {{
|
356
364
|
default {upstream_server_name}:{upstream_server_port};
|
357
365
|
}}
|
@@ -364,11 +372,11 @@ stream {
|
|
364
372
|
server {{
|
365
373
|
listen {self._remote_host['ports'][idx]} udp;
|
366
374
|
proxy_pass $upstream_{idx};
|
367
|
-
}}
|
375
|
+
}}"""
|
368
376
|
|
369
|
-
nginx_config +=
|
377
|
+
nginx_config += """
|
370
378
|
}
|
371
|
-
|
379
|
+
"""
|
372
380
|
|
373
381
|
nginx_config_bytes = nginx_config.encode()
|
374
382
|
tarfile_in_memory = io.BytesIO()
|
@@ -7,7 +7,7 @@ biolib/_internal/data_record/data_record.py,sha256=ctijrrZ-LfUxtwzS8PEVa1VBuBLVW
|
|
7
7
|
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=LPq8Lr5FhKF9_o5K-bUdT7TeLe5XFUD0AAeTkNEVZug,1133
|
8
8
|
biolib/_internal/http_client.py,sha256=38PHvRkqdjcOgRXkWU7UoYCQxHMX0eKpuwKhudDupII,4525
|
9
9
|
biolib/_internal/push_application.py,sha256=H1PGNtVJ0vRC0li39gFMpPpjm6QeZ8Ob-7cLkLmxS_Y,10009
|
10
|
-
biolib/_internal/runtime.py,sha256=
|
10
|
+
biolib/_internal/runtime.py,sha256=Ey8_3FqL8Fi3Wrb7OyLi5WrtShOs6zLbFfpzANfJRcE,2569
|
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
|
@@ -71,7 +71,7 @@ biolib/compute_node/job_worker/large_file_system.py,sha256=XXqRlVtYhs-Ji9zQGIk5K
|
|
71
71
|
biolib/compute_node/job_worker/mappings.py,sha256=Z48Kg4nbcOvsT2-9o3RRikBkqflgO4XeaWxTGz-CNvI,2499
|
72
72
|
biolib/compute_node/job_worker/utilization_reporter_thread.py,sha256=7tm5Yk9coqJ9VbEdnO86tSXI0iM0omwIyKENxdxiVXk,8575
|
73
73
|
biolib/compute_node/job_worker/utils.py,sha256=wgxcIA8yAhUPdCwyvuuJ0JmreyWmmUoBO33vWtG60xg,1282
|
74
|
-
biolib/compute_node/remote_host_proxy.py,sha256=
|
74
|
+
biolib/compute_node/remote_host_proxy.py,sha256=OjMtBePFyfDwMy9TKEiJcHc1eVyg_aDfwHxS6UZ3VCw,15763
|
75
75
|
biolib/compute_node/socker_listener_thread.py,sha256=T5_UikA3MB9bD5W_dckYLPTgixh72vKUlgbBvj9dbM0,1601
|
76
76
|
biolib/compute_node/socket_sender_thread.py,sha256=YgamPHeUm2GjMFGx8qk-99WlZhEs-kAb3q_2O6qByig,971
|
77
77
|
biolib/compute_node/utils.py,sha256=M7i_WTyxbFM3Lri9RWZ_8FeQNYrQIWpKGLfp2I55oeY,4677
|
@@ -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.1928.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
109
|
+
pybiolib-1.1.1928.dist-info/METADATA,sha256=fvGuh51Lep3dHNfn1qvShROgh4pvE6T1AS_VTLBGgtk,1508
|
110
|
+
pybiolib-1.1.1928.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
111
|
+
pybiolib-1.1.1928.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
112
|
+
pybiolib-1.1.1928.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|