pybiolib 1.1.1558__tar.gz → 1.1.1564__tar.gz
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.
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/PKG-INFO +1 -1
- pybiolib-1.1.1564/biolib/biolib_binary_format/file_in_container.py +105 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/pyproject.toml +1 -1
- pybiolib-1.1.1558/biolib/biolib_binary_format/file_in_container.py +0 -79
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/LICENSE +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/README.md +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/api/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/api/client.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/api/http_client.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/app/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/app/app.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/app/search_apps.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/api_client.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/app_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/auth.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/biolib_account_api.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/biolib_app_api.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/biolib_job_api.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/biolib_large_file_system_api.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/common_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/job_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/lfs_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/user_state.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/base_bbf_package.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/module_input.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/module_output_v2.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/remote_endpoints.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/remote_stream_seeker.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/saved_job.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/stdout_and_stderr.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/system_exception.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/system_status_update.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_binary_format/utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_docker_client/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_download_container.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_errors.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_logging.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_push.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/download_container.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/init.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/lfs.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/push.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/run.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/runtime.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/cli/start.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/.gitignore +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/cloud_utils/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/cloud_utils/cloud_utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/cache_state.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/cache_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/docker_image_cache.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/docker_executor.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/docker_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/tars/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/job_legacy_input_wait_timeout_thread.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/job_max_runtime_timer_thread.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/job_storage.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/job_worker.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/large_file_system.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/mappings.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/utilization_reporter_thread.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/remote_host_proxy.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/socker_listener_thread.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/socket_sender_thread.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/gunicorn_flask_application.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/webserver.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/webserver_types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/webserver_utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/worker_thread.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/experiments/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/experiments/experiment.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/experiments/types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/jobs/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/jobs/job.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/jobs/job_result.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/jobs/types.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/lfs/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/lfs/cache.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/lfs/utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/runtime/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/runtime/results.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/tables.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/templates/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/templates/example_app.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/typing_utils.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/user/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/user/sign_in.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/utils/__init__.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/utils/app_uri.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/utils/cache_state.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/utils/multipart_uploader.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/utils/seq_util.py +0 -0
- {pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/utils/zip/remote_zip.py +0 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
import os.path
|
2
|
+
import tarfile
|
3
|
+
import tempfile
|
4
|
+
|
5
|
+
from docker.models.containers import Container # type: ignore
|
6
|
+
|
7
|
+
from biolib.typing_utils import Iterable, Optional
|
8
|
+
|
9
|
+
|
10
|
+
class FileInContainer:
|
11
|
+
def __init__(self, container: Container, path_in_container: str, overlay_upper_dir_path: Optional[str]):
|
12
|
+
self._container: Container = container
|
13
|
+
self._path_on_disk: Optional[str] = overlay_upper_dir_path + path_in_container if overlay_upper_dir_path \
|
14
|
+
else None
|
15
|
+
|
16
|
+
self._path_in_container: str = path_in_container
|
17
|
+
self._path: str = path_in_container
|
18
|
+
self._buffered_file_data: Optional[bytes] = None
|
19
|
+
|
20
|
+
def __repr__(self) -> str:
|
21
|
+
return f'FileInContainer({self.path})'
|
22
|
+
|
23
|
+
@property
|
24
|
+
def path(self) -> str:
|
25
|
+
return self._path
|
26
|
+
|
27
|
+
@path.setter
|
28
|
+
def path(self, value: str) -> None:
|
29
|
+
self._path = value
|
30
|
+
|
31
|
+
def is_file(self) -> bool:
|
32
|
+
if self._path_on_disk:
|
33
|
+
return os.path.isfile(self._path_on_disk)
|
34
|
+
else:
|
35
|
+
tmp_file = self._get_temp_file_from_container_via_tar()
|
36
|
+
if tmp_file:
|
37
|
+
os.remove(tmp_file)
|
38
|
+
return True
|
39
|
+
else:
|
40
|
+
return False
|
41
|
+
|
42
|
+
def get_data_size_in_bytes(self) -> int:
|
43
|
+
if self._path_on_disk:
|
44
|
+
return os.path.getsize(self._path_on_disk)
|
45
|
+
else:
|
46
|
+
tmp_file = self._get_temp_file_from_container_via_tar()
|
47
|
+
if tmp_file:
|
48
|
+
file_length = os.path.getsize(tmp_file)
|
49
|
+
os.remove(tmp_file)
|
50
|
+
return file_length
|
51
|
+
else:
|
52
|
+
return 0
|
53
|
+
|
54
|
+
def get_data_stream(self) -> Iterable[bytes]:
|
55
|
+
if self._path_on_disk:
|
56
|
+
with open(self._path_on_disk, mode='rb') as file:
|
57
|
+
while True:
|
58
|
+
chunk = file.read(1_000_000)
|
59
|
+
if not chunk:
|
60
|
+
return
|
61
|
+
|
62
|
+
yield chunk
|
63
|
+
else:
|
64
|
+
tmp_file = self._get_temp_file_from_container_via_tar()
|
65
|
+
if not tmp_file:
|
66
|
+
yield bytes()
|
67
|
+
return
|
68
|
+
else:
|
69
|
+
file = open(tmp_file, mode='rb')
|
70
|
+
while True:
|
71
|
+
chunk = file.read(1_000_000)
|
72
|
+
if not chunk:
|
73
|
+
file.close()
|
74
|
+
os.remove(tmp_file)
|
75
|
+
return
|
76
|
+
|
77
|
+
yield chunk
|
78
|
+
|
79
|
+
def _get_temp_file_from_container_via_tar(self) -> Optional[str]:
|
80
|
+
with tempfile.NamedTemporaryFile(mode='w+', delete=True) as tmp_io:
|
81
|
+
stream, _ = self._container.get_archive(path=self._path_in_container)
|
82
|
+
for chunk in stream:
|
83
|
+
tmp_io.write(chunk)
|
84
|
+
|
85
|
+
tmp_io.seek(0)
|
86
|
+
with tarfile.open(tmp_io.name) as tar:
|
87
|
+
members = tar.getmembers()
|
88
|
+
file_members = [member for member in members if member.isfile()]
|
89
|
+
if not file_members:
|
90
|
+
# Path was not a file
|
91
|
+
return None
|
92
|
+
|
93
|
+
assert len(file_members) == 1
|
94
|
+
file_obj = tar.extractfile(member=file_members[0])
|
95
|
+
if not file_obj:
|
96
|
+
# Path was not a file
|
97
|
+
return None
|
98
|
+
tmp_io_2 = tempfile.NamedTemporaryFile(mode='w+', delete=False)
|
99
|
+
while True:
|
100
|
+
chunk = file_obj.read(1_000_000)
|
101
|
+
if not chunk:
|
102
|
+
break
|
103
|
+
tmp_io_2.write(chunk)
|
104
|
+
tmp_io_2.close()
|
105
|
+
return tmp_io_2.name
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import io
|
2
|
-
import os.path
|
3
|
-
import tarfile
|
4
|
-
|
5
|
-
from docker.models.containers import Container # type: ignore
|
6
|
-
|
7
|
-
from biolib.typing_utils import Iterable, Optional
|
8
|
-
|
9
|
-
|
10
|
-
class FileInContainer:
|
11
|
-
def __init__(self, container: Container, path_in_container: str, overlay_upper_dir_path: Optional[str]):
|
12
|
-
self._container: Container = container
|
13
|
-
self._path_on_disk: Optional[str] = overlay_upper_dir_path + path_in_container if overlay_upper_dir_path \
|
14
|
-
else None
|
15
|
-
|
16
|
-
self._path_in_container: str = path_in_container
|
17
|
-
self._path: str = path_in_container
|
18
|
-
self._buffered_file_data: Optional[bytes] = None
|
19
|
-
|
20
|
-
def __repr__(self) -> str:
|
21
|
-
return f'FileInContainer({self.path})'
|
22
|
-
|
23
|
-
@property
|
24
|
-
def path(self) -> str:
|
25
|
-
return self._path
|
26
|
-
|
27
|
-
@path.setter
|
28
|
-
def path(self, value: str) -> None:
|
29
|
-
self._path = value
|
30
|
-
|
31
|
-
def is_file(self) -> bool:
|
32
|
-
if self._path_on_disk:
|
33
|
-
return os.path.isfile(self._path_on_disk)
|
34
|
-
else:
|
35
|
-
return self._get_file_data_from_container_via_tar() is not None
|
36
|
-
|
37
|
-
def get_data_size_in_bytes(self) -> int:
|
38
|
-
if self._path_on_disk:
|
39
|
-
return os.path.getsize(self._path_on_disk)
|
40
|
-
else:
|
41
|
-
file_data = self._get_file_data_from_container_via_tar()
|
42
|
-
return len(file_data) if file_data else 0
|
43
|
-
|
44
|
-
def get_data_stream(self) -> Iterable[bytes]:
|
45
|
-
if self._path_on_disk:
|
46
|
-
with open(self._path_on_disk, mode='rb') as file:
|
47
|
-
while True:
|
48
|
-
chunk = file.read(1_024)
|
49
|
-
if not chunk:
|
50
|
-
return
|
51
|
-
|
52
|
-
yield chunk
|
53
|
-
else:
|
54
|
-
yield self._get_file_data_from_container_via_tar() or bytes()
|
55
|
-
|
56
|
-
def _get_file_data_from_container_via_tar(self) -> Optional[bytes]:
|
57
|
-
if not self._buffered_file_data:
|
58
|
-
with io.BytesIO() as tmp_io:
|
59
|
-
stream, _ = self._container.get_archive(path=self._path_in_container)
|
60
|
-
for chunk in stream:
|
61
|
-
tmp_io.write(chunk)
|
62
|
-
|
63
|
-
tmp_io.seek(0)
|
64
|
-
with tarfile.open(fileobj=tmp_io) as tar:
|
65
|
-
members = tar.getmembers()
|
66
|
-
file_members = [member for member in members if member.isfile()]
|
67
|
-
if not file_members:
|
68
|
-
# Path was not a file
|
69
|
-
return None
|
70
|
-
|
71
|
-
assert len(file_members) == 1
|
72
|
-
file_obj = tar.extractfile(member=file_members[0])
|
73
|
-
if not file_obj:
|
74
|
-
# Path was not a file
|
75
|
-
return None
|
76
|
-
|
77
|
-
self._buffered_file_data = file_obj.read()
|
78
|
-
|
79
|
-
return self._buffered_file_data
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/biolib_api_client/biolib_large_file_system_api.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/docker_image_cache.py
RENAMED
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/__init__.py
RENAMED
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/docker_executor.py
RENAMED
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/docker_types.py
RENAMED
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/job_worker/executors/tars/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pybiolib-1.1.1558 → pybiolib-1.1.1564}/biolib/compute_node/webserver/gunicorn_flask_application.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|