pybiolib 1.2.1121__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/webserver/compute_node_results_proxy.py +34 -1
- {pybiolib-1.2.1121.dist-info → pybiolib-1.2.1126.dist-info}/METADATA +1 -1
- {pybiolib-1.2.1121.dist-info → pybiolib-1.2.1126.dist-info}/RECORD +6 -6
- {pybiolib-1.2.1121.dist-info → pybiolib-1.2.1126.dist-info}/LICENSE +0 -0
- {pybiolib-1.2.1121.dist-info → pybiolib-1.2.1126.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.1121.dist-info → pybiolib-1.2.1126.dist-info}/entry_points.txt +0 -0
@@ -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
|
|
@@ -131,7 +131,7 @@ biolib/compute_node/socker_listener_thread.py,sha256=T5_UikA3MB9bD5W_dckYLPTgixh
|
|
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
|