pybiolib 1.1.1957__py3-none-any.whl → 1.1.1971__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/fuse_mount/__init__.py +1 -0
- biolib/_internal/fuse_mount/experiment_fuse_mount.py +198 -0
- biolib/_internal/libs/__init__.py +1 -0
- biolib/_internal/libs/fusepy/__init__.py +1257 -0
- biolib/biolib_binary_format/utils.py +9 -2
- biolib/experiments/experiment.py +29 -30
- {pybiolib-1.1.1957.dist-info → pybiolib-1.1.1971.dist-info}/METADATA +1 -1
- {pybiolib-1.1.1957.dist-info → pybiolib-1.1.1971.dist-info}/RECORD +11 -7
- {pybiolib-1.1.1957.dist-info → pybiolib-1.1.1971.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.1957.dist-info → pybiolib-1.1.1971.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.1957.dist-info → pybiolib-1.1.1971.dist-info}/entry_points.txt +0 -0
@@ -148,8 +148,15 @@ class LazyLoadedFile:
|
|
148
148
|
def get_file_handle(self) -> io.BufferedIOBase:
|
149
149
|
return io.BytesIO(self.get_data())
|
150
150
|
|
151
|
-
def get_data(self) -> bytes:
|
152
|
-
|
151
|
+
def get_data(self, start=0, length=None) -> bytes:
|
152
|
+
start_offset = start + self.start
|
153
|
+
# make sure length doesn't go outside file boundaries
|
154
|
+
length_to_end_of_file = max(self._length - start, 0)
|
155
|
+
if length is None:
|
156
|
+
length_to_request = length_to_end_of_file
|
157
|
+
else:
|
158
|
+
length_to_request = min(length, length_to_end_of_file)
|
159
|
+
return self._buffer.get_data(start=start_offset, length=length_to_request)
|
153
160
|
|
154
161
|
def get_data_iterator(self) -> Iterator[bytes]:
|
155
162
|
if self._length == 0:
|
biolib/experiments/experiment.py
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
import time
|
2
2
|
from collections import OrderedDict
|
3
3
|
|
4
|
-
from biolib.biolib_errors import BioLibError
|
5
|
-
from biolib.jobs.types import JobsPaginatedResponse
|
6
|
-
from biolib.typing_utils import List, Optional
|
7
|
-
|
8
4
|
from biolib import api
|
5
|
+
from biolib.biolib_errors import BioLibError
|
9
6
|
from biolib.experiments.types import ExperimentDict
|
10
7
|
from biolib.jobs.job import Job
|
11
|
-
from biolib.
|
12
|
-
|
8
|
+
from biolib.jobs.types import JobsPaginatedResponse
|
13
9
|
from biolib.tables import BioLibTable
|
10
|
+
from biolib.typing_utils import Dict, List, Optional, Union
|
14
11
|
|
15
12
|
|
16
13
|
class Experiment:
|
17
14
|
_BIOLIB_EXPERIMENTS: List['Experiment'] = []
|
18
15
|
|
19
16
|
# Columns to print in table when showing Job
|
20
|
-
_table_columns_to_row_map = OrderedDict(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
_table_columns_to_row_map = OrderedDict(
|
18
|
+
{
|
19
|
+
'Name': {'key': 'name', 'params': {}},
|
20
|
+
'Job Count': {'key': 'job_count', 'params': {}},
|
21
|
+
'Created At': {'key': 'created_at', 'params': {}},
|
22
|
+
}
|
23
|
+
)
|
25
24
|
|
26
25
|
def __init__(self, name: str):
|
27
26
|
self._experiment_dict: ExperimentDict = self._create_in_backend_or_get_experiment_dict(name)
|
@@ -55,16 +54,11 @@ class Experiment:
|
|
55
54
|
# Prints a table listing info about experiments accessible to the user
|
56
55
|
@staticmethod
|
57
56
|
def show_experiments(count: int = 25) -> None:
|
58
|
-
experiment_dicts = api.client.get(
|
59
|
-
path='/experiments/',
|
60
|
-
params={
|
61
|
-
'page_size': str(count)
|
62
|
-
}
|
63
|
-
).json()['results']
|
57
|
+
experiment_dicts = api.client.get(path='/experiments/', params={'page_size': str(count)}).json()['results']
|
64
58
|
BioLibTable(
|
65
59
|
columns_to_row_map=Experiment._table_columns_to_row_map,
|
66
60
|
rows=experiment_dicts,
|
67
|
-
title='Experiments'
|
61
|
+
title='Experiments',
|
68
62
|
).print_table()
|
69
63
|
|
70
64
|
def wait(self) -> None:
|
@@ -77,10 +71,20 @@ class Experiment:
|
|
77
71
|
print(f'All jobs of experiment {self.name} have finished')
|
78
72
|
|
79
73
|
def add_job(self, job_id: str) -> None:
|
80
|
-
api.client.patch(
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
api.client.patch(path=f'/jobs/{job_id}/', data={'experiment_uuid': self.uuid})
|
75
|
+
|
76
|
+
def mount_files(self, path: str) -> None:
|
77
|
+
try:
|
78
|
+
# Only attempt to import FUSE dependencies when strictly necessary
|
79
|
+
from biolib._internal.fuse_mount import ( # pylint: disable=import-outside-toplevel
|
80
|
+
ExperimentFuseMount as _ExperimentFuseMount,
|
81
|
+
)
|
82
|
+
except ImportError as error:
|
83
|
+
raise ImportError(
|
84
|
+
'Failed to import FUSE mounting utils. Please ensure FUSE is installed on your system.'
|
85
|
+
) from error
|
86
|
+
|
87
|
+
_ExperimentFuseMount.mount(experiment=self, path=path)
|
84
88
|
|
85
89
|
def export_job_list(self, export_format='dicts'):
|
86
90
|
valid_formats = ('dicts', 'dataframe')
|
@@ -98,7 +102,7 @@ class Experiment:
|
|
98
102
|
raise ImportError(
|
99
103
|
'Pandas must be installed to use this method. '
|
100
104
|
'Alternatively, use .get_jobs() to get a list of job objects.'
|
101
|
-
|
105
|
+
) from error
|
102
106
|
|
103
107
|
jobs_df = pd.DataFrame.from_dict(job_dict_list)
|
104
108
|
jobs_df.started_at = pd.to_datetime(jobs_df.started_at)
|
@@ -125,7 +129,7 @@ class Experiment:
|
|
125
129
|
BioLibTable(
|
126
130
|
columns_to_row_map=Job.table_columns_to_row_map,
|
127
131
|
rows=[job._job_dict for job in jobs], # pylint: disable=protected-access
|
128
|
-
title=f'Jobs in experiment: "{self.name}"'
|
132
|
+
title=f'Jobs in experiment: "{self.name}"',
|
129
133
|
).print_table()
|
130
134
|
|
131
135
|
def get_jobs(self, status: Optional[str] = None) -> List[Job]:
|
@@ -149,12 +153,7 @@ class Experiment:
|
|
149
153
|
|
150
154
|
def _create_in_backend_or_get_experiment_dict(self, name: str) -> ExperimentDict:
|
151
155
|
# This endpoint returns experiment dict if already created
|
152
|
-
experiment_dict: ExperimentDict = api.client.post(
|
153
|
-
path='/experiments/',
|
154
|
-
data={
|
155
|
-
'name': name
|
156
|
-
}
|
157
|
-
).json()
|
156
|
+
experiment_dict: ExperimentDict = api.client.post(path='/experiments/', data={'name': name}).json()
|
158
157
|
return experiment_dict
|
159
158
|
|
160
159
|
def _refetch_experiment_dict(self) -> None:
|
@@ -5,7 +5,11 @@ biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
5
5
|
biolib/_internal/data_record/__init__.py,sha256=1Bk303i3rFet9veS56fIsrBYtT5X3n9vcsYMA6T6c5o,36
|
6
6
|
biolib/_internal/data_record/data_record.py,sha256=ctijrrZ-LfUxtwzS8PEVa1VBuBLVWEhmo2yHcEDkC0A,7178
|
7
7
|
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=LPq8Lr5FhKF9_o5K-bUdT7TeLe5XFUD0AAeTkNEVZug,1133
|
8
|
+
biolib/_internal/fuse_mount/__init__.py,sha256=B_tM6RM2dBw-vbpoHJC4X3tOAaN1H2RDvqYJOw3xFwg,55
|
9
|
+
biolib/_internal/fuse_mount/experiment_fuse_mount.py,sha256=tRkgPncbf9Nl22adcjBTJuFfiYMkayYJSJ--WQrB-Ps,6629
|
8
10
|
biolib/_internal/http_client.py,sha256=DdooXei93JKGYGV4aQmzue_oFzvHkozg2UCxgk9dfDM,5081
|
11
|
+
biolib/_internal/libs/__init__.py,sha256=Jdf4tNPqe_oIIf6zYml6TiqhL_02Vyqwge6IELrAFhw,98
|
12
|
+
biolib/_internal/libs/fusepy/__init__.py,sha256=AWDzNFS-XV_5yKb0Qx7kggIhPzq1nj_BZS5y2Nso08k,41944
|
9
13
|
biolib/_internal/push_application.py,sha256=H1PGNtVJ0vRC0li39gFMpPpjm6QeZ8Ob-7cLkLmxS_Y,10009
|
10
14
|
biolib/_internal/runtime.py,sha256=BnFvRWYnxPXCgOtfxupN255Zxx9Gw6oPZyzUIGODw3k,3060
|
11
15
|
biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
|
@@ -35,7 +39,7 @@ biolib/biolib_binary_format/saved_job.py,sha256=nFHVFRNTNcAFGODLSiBntCtMk55QKwre
|
|
35
39
|
biolib/biolib_binary_format/stdout_and_stderr.py,sha256=WfUUJFFCBrtfXjuWIaRPiWCpuBLxfko68oxoTKhrwx8,1023
|
36
40
|
biolib/biolib_binary_format/system_exception.py,sha256=T3iL4_cSHAHim3RSDPS8Xyb1mfteaJBZonSXuRltc28,853
|
37
41
|
biolib/biolib_binary_format/system_status_update.py,sha256=aOELuQ0k-GtpaZTUxYd0GFomP_OInmrK585y6fuQuKE,1191
|
38
|
-
biolib/biolib_binary_format/utils.py,sha256
|
42
|
+
biolib/biolib_binary_format/utils.py,sha256=ra_plrh_Z10u98O2gW9uW2qzscQZCfq91SOznmDTY64,5170
|
39
43
|
biolib/biolib_docker_client/__init__.py,sha256=aBfA6mtWSI5dBEfNNMD6bIZzCPloW4ghKm0wqQiljdo,1481
|
40
44
|
biolib/biolib_download_container.py,sha256=8TmBV8iv3bCvkNlHa1SSsc4zl0wX_eaxhfnW5rvFIh8,1779
|
41
45
|
biolib/biolib_errors.py,sha256=5m4lK2l39DafpoXBImEBD4EPH3ayXBX0JgtPzmGClow,689
|
@@ -82,7 +86,7 @@ biolib/compute_node/webserver/webserver_types.py,sha256=Vmt1ZDecYhGBVEYWcW1DVxee
|
|
82
86
|
biolib/compute_node/webserver/webserver_utils.py,sha256=XWvwYPbWNR3qS0FYbLLp-MDDfVk0QdaAmg3xPrT0H2s,4234
|
83
87
|
biolib/compute_node/webserver/worker_thread.py,sha256=26tG73TADnOcXsAr7Iyf6smrLlCqB4x-vvmpUb8WqnA,11569
|
84
88
|
biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
85
|
-
biolib/experiments/experiment.py,sha256=
|
89
|
+
biolib/experiments/experiment.py,sha256=kUQsH9AGAckPKT_nzaRuTh8Mb2pVUpxnuX9IstRTOEo,6351
|
86
90
|
biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
|
87
91
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
88
92
|
biolib/jobs/job.py,sha256=WFcHYYOkvAhmYRUykWFbjhshiF_dy1-eiPIMCS1CIeo,16157
|
@@ -105,8 +109,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
105
109
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
106
110
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
107
111
|
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.
|
112
|
+
pybiolib-1.1.1971.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.1971.dist-info/METADATA,sha256=Ldnxyz9Y43LOU6soZJP8EulbEQuVLL1zVaz-bGEObK4,1508
|
114
|
+
pybiolib-1.1.1971.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.1971.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.1971.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|