pybiolib 1.1.2090__py3-none-any.whl → 1.1.2109__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/cli/data_record.py +40 -5
- biolib/cli/lfs.py +4 -0
- biolib/compute_node/job_worker/executors/docker_executor.py +8 -3
- {pybiolib-1.1.2090.dist-info → pybiolib-1.1.2109.dist-info}/METADATA +1 -1
- {pybiolib-1.1.2090.dist-info → pybiolib-1.1.2109.dist-info}/RECORD +8 -8
- {pybiolib-1.1.2090.dist-info → pybiolib-1.1.2109.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.2090.dist-info → pybiolib-1.1.2109.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.2090.dist-info → pybiolib-1.1.2109.dist-info}/entry_points.txt +0 -0
biolib/cli/data_record.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
import json
|
1
2
|
import logging
|
2
3
|
import os
|
4
|
+
from typing import Dict, List
|
3
5
|
|
4
6
|
import click
|
5
7
|
|
6
8
|
from biolib._data_record.data_record import DataRecord
|
7
9
|
from biolib.biolib_logging import logger, logger_no_user_data
|
8
|
-
from biolib.sdk import create_data_record
|
9
10
|
from biolib.typing_utils import Optional
|
10
11
|
|
11
12
|
|
@@ -16,11 +17,18 @@ def data_record() -> None:
|
|
16
17
|
|
17
18
|
|
18
19
|
@data_record.command(help='Create a Data Record')
|
19
|
-
@click.
|
20
|
+
@click.argument('uri', required=True)
|
21
|
+
@click.option('--data-path', required=True, type=click.Path(exists=True))
|
22
|
+
def create(uri: str, data_path: str) -> None:
|
23
|
+
DataRecord.create(destination=uri, data_path=data_path)
|
24
|
+
|
25
|
+
|
26
|
+
@data_record.command(help='Update a Data Record')
|
27
|
+
@click.argument('uri', required=True)
|
20
28
|
@click.option('--data-path', required=True, type=click.Path(exists=True))
|
21
|
-
@click.option('--
|
22
|
-
def
|
23
|
-
|
29
|
+
@click.option('--chunk-size', default=None, required=False, type=click.INT, help='The size of each chunk (In MB)')
|
30
|
+
def update(uri: str, data_path: str, chunk_size: Optional[int]) -> None:
|
31
|
+
DataRecord.get_by_uri(uri=uri).update(data_path=data_path, chunk_size_in_mb=chunk_size)
|
24
32
|
|
25
33
|
|
26
34
|
@data_record.command(help='Download files from a Data Record')
|
@@ -42,3 +50,30 @@ def download(uri: str, file: Optional[str], path_filter: Optional[str]) -> None:
|
|
42
50
|
else:
|
43
51
|
assert not os.path.exists(record.name), f'Directory with name {record.name} already exists in current directory'
|
44
52
|
record.save_files(output_dir=record.name, path_filter=path_filter)
|
53
|
+
|
54
|
+
|
55
|
+
@data_record.command(help='Describe a Data Record')
|
56
|
+
@click.argument('uri', required=True)
|
57
|
+
@click.option('--json', 'output_as_json', is_flag=True, default=False, required=False, help='Format output as JSON')
|
58
|
+
def describe(uri: str, output_as_json: bool) -> None:
|
59
|
+
record = DataRecord.get_by_uri(uri)
|
60
|
+
files_info: List[Dict] = []
|
61
|
+
total_size_in_bytes = 0
|
62
|
+
for file in record.list_files():
|
63
|
+
files_info.append({'path': file.path, 'size_bytes': file.length})
|
64
|
+
total_size_in_bytes += file.length
|
65
|
+
|
66
|
+
if output_as_json:
|
67
|
+
print(
|
68
|
+
json.dumps(
|
69
|
+
obj={'uri': record.uri, 'size_bytes': total_size_in_bytes, 'files': files_info},
|
70
|
+
indent=4,
|
71
|
+
)
|
72
|
+
)
|
73
|
+
else:
|
74
|
+
print(f'Data Record {record.uri}\ntotal {total_size_in_bytes} bytes\n')
|
75
|
+
print('size bytes path')
|
76
|
+
for file_info in files_info:
|
77
|
+
size_string = str(file_info['size_bytes'])
|
78
|
+
leading_space_string = ' ' * (10 - len(size_string))
|
79
|
+
print(f"{leading_space_string}{size_string} {file_info['path']}")
|
biolib/cli/lfs.py
CHANGED
@@ -21,6 +21,7 @@ def lfs() -> None:
|
|
21
21
|
@lfs.command(help='Create a Large File System')
|
22
22
|
@click.argument('uri', required=True)
|
23
23
|
def create(uri: str) -> None:
|
24
|
+
logger.warning('This is command deprecated, please use "biolib data-record create" instead.')
|
24
25
|
logger.configure(default_log_level=logging.INFO)
|
25
26
|
logger_no_user_data.configure(default_log_level=logging.INFO)
|
26
27
|
DataRecord.create(destination=uri)
|
@@ -31,6 +32,7 @@ def create(uri: str) -> None:
|
|
31
32
|
@click.option('--path', required=True, type=click.Path(exists=True))
|
32
33
|
@click.option('--chunk-size', default=None, required=False, type=click.INT, help='The size of each chunk (In MB)')
|
33
34
|
def push(uri: str, path: str, chunk_size: Optional[int]) -> None:
|
35
|
+
logger.warning('This is command deprecated, please use "biolib data-record update" instead.')
|
34
36
|
logger.configure(default_log_level=logging.INFO)
|
35
37
|
logger_no_user_data.configure(default_log_level=logging.INFO)
|
36
38
|
try:
|
@@ -44,6 +46,7 @@ def push(uri: str, path: str, chunk_size: Optional[int]) -> None:
|
|
44
46
|
@click.argument('uri', required=True)
|
45
47
|
@click.option('--file-path', required=True, type=str)
|
46
48
|
def download_file(uri: str, file_path: str) -> None:
|
49
|
+
logger.warning('This is command deprecated, please use "biolib data-record download" instead.')
|
47
50
|
logger.configure(default_log_level=logging.INFO)
|
48
51
|
logger_no_user_data.configure(default_log_level=logging.INFO)
|
49
52
|
try:
|
@@ -66,6 +69,7 @@ def download_file(uri: str, file_path: str) -> None:
|
|
66
69
|
@click.argument('uri', required=True)
|
67
70
|
@click.option('--json', 'output_as_json', is_flag=True, default=False, required=False, help='Format output as JSON')
|
68
71
|
def describe(uri: str, output_as_json: bool) -> None:
|
72
|
+
logger.warning('This is command deprecated, please use "biolib data-record describe" instead.')
|
69
73
|
data_record = DataRecord.get_by_uri(uri)
|
70
74
|
files_info: List[Dict] = []
|
71
75
|
total_size_in_bytes = 0
|
@@ -270,6 +270,8 @@ class DockerExecutor:
|
|
270
270
|
# TODO: type this method
|
271
271
|
def _initialize_docker_container(self, module_input):
|
272
272
|
try:
|
273
|
+
job_uuid = self._options['job']['public_id']
|
274
|
+
logger_no_user_data.debug(f'Job "{job_uuid}" initializing Docker container...')
|
273
275
|
module = self._options['module']
|
274
276
|
logger.debug(f"Initializing docker container with command: {module['command']}")
|
275
277
|
|
@@ -314,6 +316,7 @@ class DockerExecutor:
|
|
314
316
|
}
|
315
317
|
)
|
316
318
|
|
319
|
+
logger_no_user_data.debug(f'Job "{job_uuid}" initializing Docker container. Getting IPs for proxies...')
|
317
320
|
for proxy in self._options['remote_host_proxies']:
|
318
321
|
proxy_ip = proxy.get_ip_address_on_network(internal_network)
|
319
322
|
if proxy.is_app_caller_proxy:
|
@@ -332,6 +335,7 @@ class DockerExecutor:
|
|
332
335
|
else:
|
333
336
|
extra_hosts[proxy.hostname] = proxy_ip
|
334
337
|
|
338
|
+
logger_no_user_data.debug(f'Job "{job_uuid}" initializing Docker container. Constructing container args...')
|
335
339
|
create_container_args = {
|
336
340
|
'environment': environment_vars,
|
337
341
|
'extra_hosts': extra_hosts,
|
@@ -368,9 +372,10 @@ class DockerExecutor:
|
|
368
372
|
if docker_runtime is not None:
|
369
373
|
create_container_args['runtime'] = docker_runtime
|
370
374
|
|
371
|
-
|
372
|
-
|
373
|
-
|
375
|
+
docker_client = BiolibDockerClient.get_docker_client()
|
376
|
+
logger_no_user_data.debug(f'Job "{job_uuid}" initializing Docker container. Creating container...')
|
377
|
+
self._docker_container = docker_client.containers.create(**create_container_args)
|
378
|
+
logger_no_user_data.debug(f'Job "{job_uuid}" finished initializing Docker container.')
|
374
379
|
except Exception as exception:
|
375
380
|
raise ComputeProcessException(
|
376
381
|
exception, SystemExceptionCodes.FAILED_TO_START_COMPUTE_CONTAINER.value, self._send_system_exception
|
@@ -51,10 +51,10 @@ biolib/biolib_errors.py,sha256=5m4lK2l39DafpoXBImEBD4EPH3ayXBX0JgtPzmGClow,689
|
|
51
51
|
biolib/biolib_logging.py,sha256=J3E5H_LL5k6ZUim2C8gqN7E6lCBZMTpO4tnMpOPwG9U,2854
|
52
52
|
biolib/cli/__init__.py,sha256=0v3c_J-U0k46c5ZWeQjLG_kTaKDJm81LBxQpDO2B_aI,1286
|
53
53
|
biolib/cli/auth.py,sha256=rpWGmXs6Fz6CGrO9K8ibPRszOdXG78Vig_boKaVCD9A,2082
|
54
|
-
biolib/cli/data_record.py,sha256=
|
54
|
+
biolib/cli/data_record.py,sha256=oDy8U6mv-h-hbeMihXRzVEvM-WrGQq6oBiBl3xDRaXs,3220
|
55
55
|
biolib/cli/download_container.py,sha256=HIZVHOPmslGE5M2Dsp9r2cCkAEJx__vcsDz5Wt5LRos,483
|
56
56
|
biolib/cli/init.py,sha256=wQOfii_au-d30Hp7DdH-WVw-WVraKvA_zY4za1w7DE8,821
|
57
|
-
biolib/cli/lfs.py,sha256=
|
57
|
+
biolib/cli/lfs.py,sha256=z2qHUwink85mv9yDgifbVKkVwuyknGhMDTfly_gLKJM,4151
|
58
58
|
biolib/cli/push.py,sha256=TFi7O9tJ3zFe0VmtVTV3Vh9_xIMHnrc41xxcaBKU46g,813
|
59
59
|
biolib/cli/run.py,sha256=BbvXLQ-XibjQ71Y2d4URMH_8dflNVwM0i3TIWhw_u_c,1634
|
60
60
|
biolib/cli/runtime.py,sha256=Xv-nrma5xX8NidWcvbUKcUvuN5TCarZa4A8mPVmF-z0,361
|
@@ -68,7 +68,7 @@ biolib/compute_node/job_worker/cache_state.py,sha256=MwjSRzcJJ_4jybqvBL4xdgnDYSI
|
|
68
68
|
biolib/compute_node/job_worker/cache_types.py,sha256=ajpLy8i09QeQS9dEqTn3T6NVNMY_YsHQkSD5nvIHccQ,818
|
69
69
|
biolib/compute_node/job_worker/docker_image_cache.py,sha256=ansHIkJIq_EMW1nZNlW-RRLVVeKWTbzNICYaOHpKiRE,7460
|
70
70
|
biolib/compute_node/job_worker/executors/__init__.py,sha256=bW6t1qi3PZTlHM4quaTLa8EI4ALTCk83cqcVJfJfJfE,145
|
71
|
-
biolib/compute_node/job_worker/executors/docker_executor.py,sha256=
|
71
|
+
biolib/compute_node/job_worker/executors/docker_executor.py,sha256=2H7GooL0oAifPcbie0unatB4fRoHyqbsr6S91uagc_g,27952
|
72
72
|
biolib/compute_node/job_worker/executors/docker_types.py,sha256=VhsU1DKtJjx_BbCkVmiPZPH4ROiL1ygW1Y_s1Kbpa2o,216
|
73
73
|
biolib/compute_node/job_worker/executors/tars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
74
74
|
biolib/compute_node/job_worker/executors/types.py,sha256=yP5gG39hr-DLnw9bOE--VHi-1arDbIYiGuV1rlTbbHI,1466
|
@@ -111,8 +111,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
111
111
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
112
112
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
113
113
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
114
|
-
pybiolib-1.1.
|
115
|
-
pybiolib-1.1.
|
116
|
-
pybiolib-1.1.
|
117
|
-
pybiolib-1.1.
|
118
|
-
pybiolib-1.1.
|
114
|
+
pybiolib-1.1.2109.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
115
|
+
pybiolib-1.1.2109.dist-info/METADATA,sha256=Ib3gPLhMCJEEmlmAf7rgaOg4ZR2x1pQef1XCOCryito,1508
|
116
|
+
pybiolib-1.1.2109.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
117
|
+
pybiolib-1.1.2109.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
118
|
+
pybiolib-1.1.2109.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|