pybiolib 1.2.1117__py3-none-any.whl → 1.2.1126__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/compute_node/remote_host_proxy.py +20 -0
- biolib/compute_node/webserver/compute_node_results_proxy.py +35 -2
- {pybiolib-1.2.1117.dist-info → pybiolib-1.2.1126.dist-info}/METADATA +1 -1
- {pybiolib-1.2.1117.dist-info → pybiolib-1.2.1126.dist-info}/RECORD +7 -7
- {pybiolib-1.2.1117.dist-info → pybiolib-1.2.1126.dist-info}/LICENSE +0 -0
- {pybiolib-1.2.1117.dist-info → pybiolib-1.2.1126.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.1117.dist-info → pybiolib-1.2.1126.dist-info}/entry_points.txt +0 -0
@@ -355,6 +355,26 @@ http {{
|
|
355
355
|
return 404 "Not found";
|
356
356
|
}}
|
357
357
|
}}
|
358
|
+
|
359
|
+
server {{
|
360
|
+
listen 1080;
|
361
|
+
resolver 127.0.0.11 ipv6=off valid=30s;
|
362
|
+
|
363
|
+
if ($http_biolib_result_uuid != "{self._job_uuid}") {{
|
364
|
+
return 403 "Invalid or missing biolib-result-uuid header";
|
365
|
+
}}
|
366
|
+
|
367
|
+
if ($http_biolib_result_port = "") {{
|
368
|
+
return 400 "Missing biolib-result-port header";
|
369
|
+
}}
|
370
|
+
|
371
|
+
location / {{
|
372
|
+
proxy_pass http://main:$http_biolib_result_port$request_uri$is_args$args;
|
373
|
+
proxy_set_header biolib-result-uuid "";
|
374
|
+
proxy_set_header biolib-result-port "";
|
375
|
+
proxy_pass_request_headers on;
|
376
|
+
}}
|
377
|
+
}}
|
358
378
|
}}
|
359
379
|
"""
|
360
380
|
else:
|
@@ -1,16 +1,41 @@
|
|
1
1
|
import io
|
2
2
|
import tarfile
|
3
|
+
import threading
|
3
4
|
import time
|
4
5
|
|
5
6
|
from docker.models.containers import Container
|
6
7
|
|
7
8
|
from biolib.biolib_docker_client import BiolibDockerClient
|
8
9
|
from biolib.biolib_errors import BioLibError
|
9
|
-
from biolib.biolib_logging import logger_no_user_data
|
10
|
+
from biolib.biolib_logging import logger_no_user_data, logger
|
10
11
|
from biolib.compute_node.utils import BIOLIB_PROXY_NETWORK_NAME
|
11
12
|
from biolib.typing_utils import Optional
|
12
13
|
from biolib.compute_node.webserver.proxy_utils import get_biolib_nginx_proxy_image
|
13
14
|
|
15
|
+
|
16
|
+
class LogStreamingThread(threading.Thread):
|
17
|
+
def __init__(self, container, container_name: str):
|
18
|
+
super().__init__(daemon=True)
|
19
|
+
self._container = container
|
20
|
+
self._container_name = container_name
|
21
|
+
self._stop_event = threading.Event()
|
22
|
+
|
23
|
+
def run(self) -> None:
|
24
|
+
try:
|
25
|
+
logger_no_user_data.debug(f'Starting log streaming for container "{self._container_name}"')
|
26
|
+
log_stream = self._container.logs(follow=True, stream=True)
|
27
|
+
for log_line in log_stream:
|
28
|
+
if self._stop_event.is_set():
|
29
|
+
break
|
30
|
+
if log_line:
|
31
|
+
logger.debug(f'ComputeNodeResultsProxy | {log_line.decode("utf-8").rstrip()}')
|
32
|
+
except Exception as error:
|
33
|
+
logger_no_user_data.debug(f'Log streaming for container "{self._container_name}" ended: {error}')
|
34
|
+
|
35
|
+
def stop(self) -> None:
|
36
|
+
self._stop_event.set()
|
37
|
+
|
38
|
+
|
14
39
|
class ComputeNodeResultsProxy:
|
15
40
|
_instance: Optional['ComputeNodeResultsProxy'] = None
|
16
41
|
|
@@ -22,6 +47,7 @@ class ComputeNodeResultsProxy:
|
|
22
47
|
self._docker = BiolibDockerClient().get_docker_client()
|
23
48
|
self._tls_pem_certificate_path = tls_pem_certificate_path
|
24
49
|
self._tls_pem_key_path = tls_pem_key_path
|
50
|
+
self._log_streaming_thread: Optional[LogStreamingThread] = None
|
25
51
|
|
26
52
|
@staticmethod
|
27
53
|
def start_proxy(tls_pem_certificate_path: str, tls_pem_key_path: str) -> None:
|
@@ -81,7 +107,14 @@ class ComputeNodeResultsProxy:
|
|
81
107
|
|
82
108
|
self._container.reload()
|
83
109
|
|
110
|
+
self._log_streaming_thread = LogStreamingThread(self._container, self._name)
|
111
|
+
self._log_streaming_thread.start()
|
112
|
+
logger_no_user_data.debug(f'Started log streaming for container "{self._name}"')
|
113
|
+
|
84
114
|
def _terminate(self):
|
115
|
+
if self._log_streaming_thread:
|
116
|
+
self._log_streaming_thread.stop()
|
117
|
+
self._log_streaming_thread = None
|
85
118
|
if self._container:
|
86
119
|
self._container.remove(force=True)
|
87
120
|
|
@@ -119,7 +152,7 @@ http {
|
|
119
152
|
}
|
120
153
|
|
121
154
|
set $target_host "biolib-app-caller-proxy-$http_biolib_result_uuid";
|
122
|
-
proxy_pass http://$target_host:1080;
|
155
|
+
proxy_pass http://$target_host:1080$request_uri$is_args$args;
|
123
156
|
proxy_set_header biolib-result-uuid $http_biolib_result_uuid;
|
124
157
|
proxy_set_header biolib-result-port $http_biolib_result_port;
|
125
158
|
proxy_pass_request_headers on;
|
@@ -126,12 +126,12 @@ biolib/compute_node/job_worker/large_file_system.py,sha256=Xe_LILVfTD9LXb-0HwLqG
|
|
126
126
|
biolib/compute_node/job_worker/mappings.py,sha256=Z48Kg4nbcOvsT2-9o3RRikBkqflgO4XeaWxTGz-CNvI,2499
|
127
127
|
biolib/compute_node/job_worker/utilization_reporter_thread.py,sha256=7tm5Yk9coqJ9VbEdnO86tSXI0iM0omwIyKENxdxiVXk,8575
|
128
128
|
biolib/compute_node/job_worker/utils.py,sha256=wgxcIA8yAhUPdCwyvuuJ0JmreyWmmUoBO33vWtG60xg,1282
|
129
|
-
biolib/compute_node/remote_host_proxy.py,sha256=
|
129
|
+
biolib/compute_node/remote_host_proxy.py,sha256=wNIRznw7_OFI8QHejlXYoWqac4n0IKCwZjQ1aa8i_5I,16953
|
130
130
|
biolib/compute_node/socker_listener_thread.py,sha256=T5_UikA3MB9bD5W_dckYLPTgixh72vKUlgbBvj9dbM0,1601
|
131
131
|
biolib/compute_node/socket_sender_thread.py,sha256=YgamPHeUm2GjMFGx8qk-99WlZhEs-kAb3q_2O6qByig,971
|
132
132
|
biolib/compute_node/utils.py,sha256=fvdbetPKMdfHkPqNZRw6eln_i13myu-n8tuceTUcfPU,4913
|
133
133
|
biolib/compute_node/webserver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
134
|
-
biolib/compute_node/webserver/compute_node_results_proxy.py,sha256=
|
134
|
+
biolib/compute_node/webserver/compute_node_results_proxy.py,sha256=NS-IeM9DJDZ3on7PQuLknlqTWys150fNiX_UOEoDjrE,6966
|
135
135
|
biolib/compute_node/webserver/gunicorn_flask_application.py,sha256=jPfR_YvNBekLUXWo_vHFV-FIwlb8s8tacKmGHvh93qc,914
|
136
136
|
biolib/compute_node/webserver/proxy_utils.py,sha256=JNt1oqPuR5n63E5NC1l8AZN51NLuMw4lqVkocZnq72o,1164
|
137
137
|
biolib/compute_node/webserver/webserver.py,sha256=XOLYIJcrs_MU3uvct7SGPn8cYDi8ugA_wkDo6JeOQDU,9061
|
@@ -157,8 +157,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
157
157
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
158
158
|
biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
|
159
159
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
160
|
-
pybiolib-1.2.
|
161
|
-
pybiolib-1.2.
|
162
|
-
pybiolib-1.2.
|
163
|
-
pybiolib-1.2.
|
164
|
-
pybiolib-1.2.
|
160
|
+
pybiolib-1.2.1126.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
161
|
+
pybiolib-1.2.1126.dist-info/METADATA,sha256=gF-zLDskizcBdYx8S0dqfzB9Q-24tRvIzGicdAFjXsc,1571
|
162
|
+
pybiolib-1.2.1126.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
163
|
+
pybiolib-1.2.1126.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
164
|
+
pybiolib-1.2.1126.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|