pybiolib 1.1.2017__py3-none-any.whl → 1.1.2025__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/data_record/data_record.py +9 -6
- biolib/experiments/experiment.py +29 -8
- {pybiolib-1.1.2017.dist-info → pybiolib-1.1.2025.dist-info}/METADATA +1 -1
- {pybiolib-1.1.2017.dist-info → pybiolib-1.1.2025.dist-info}/RECORD +7 -7
- {pybiolib-1.1.2017.dist-info → pybiolib-1.1.2025.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.2017.dist-info → pybiolib-1.1.2025.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.2017.dist-info → pybiolib-1.1.2025.dist-info}/entry_points.txt +0 -0
@@ -22,11 +22,6 @@ PathFilter = Union[str, Callable[[str], bool]]
|
|
22
22
|
class DataRecord:
|
23
23
|
def __init__(self, uri: str):
|
24
24
|
self._uri = uri
|
25
|
-
uri_parsed = parse_app_uri(uri, use_account_as_name_default=False)
|
26
|
-
if not uri_parsed['app_name']:
|
27
|
-
raise ValueError('Expected parameter "uri" to contain resource name')
|
28
|
-
|
29
|
-
self._name = uri_parsed['app_name']
|
30
25
|
|
31
26
|
def __repr__(self):
|
32
27
|
return f'DataRecord: {self._uri}'
|
@@ -37,7 +32,11 @@ class DataRecord:
|
|
37
32
|
|
38
33
|
@property
|
39
34
|
def name(self) -> str:
|
40
|
-
|
35
|
+
uri_parsed = parse_app_uri(self.uri, use_account_as_name_default=False)
|
36
|
+
if not uri_parsed['app_name']:
|
37
|
+
raise ValueError('Expected parameter "uri" to contain resource name')
|
38
|
+
|
39
|
+
return uri_parsed['app_name']
|
41
40
|
|
42
41
|
def list_files(self, path_filter: Optional[PathFilter] = None) -> List[LazyLoadedFile]:
|
43
42
|
app_response: AppGetResponse = api_client.get(path='/app/', params={'uri': self._uri}).json()
|
@@ -76,6 +75,10 @@ class DataRecord:
|
|
76
75
|
def save_files(self, output_dir: str, path_filter: Optional[PathFilter] = None) -> None:
|
77
76
|
self.download_files(output_dir=output_dir, path_filter=path_filter)
|
78
77
|
|
78
|
+
def update(self, data_path: str) -> None:
|
79
|
+
assert os.path.isdir(data_path), f'The path "{data_path}" is not a directory.'
|
80
|
+
self._uri = lfs.push_large_file_system(lfs_uri=self._uri, input_dir=data_path)
|
81
|
+
|
79
82
|
@staticmethod
|
80
83
|
def create(destination: str, data_path: str, name: Optional[str] = None) -> 'DataRecord':
|
81
84
|
assert os.path.isdir(data_path), f'The path "{data_path}" is not a directory.'
|
biolib/experiments/experiment.py
CHANGED
@@ -2,7 +2,8 @@ import time
|
|
2
2
|
from collections import OrderedDict
|
3
3
|
|
4
4
|
from biolib import api
|
5
|
-
from biolib.
|
5
|
+
from biolib._internal.http_client import HttpError
|
6
|
+
from biolib.biolib_errors import BioLibError, NotFound
|
6
7
|
from biolib.experiments.types import ExperimentDict
|
7
8
|
from biolib.jobs.job import Job
|
8
9
|
from biolib.jobs.types import JobsPaginatedResponse
|
@@ -22,8 +23,8 @@ class Experiment:
|
|
22
23
|
}
|
23
24
|
)
|
24
25
|
|
25
|
-
def __init__(self,
|
26
|
-
self._experiment_dict: ExperimentDict = self.
|
26
|
+
def __init__(self, uri: str):
|
27
|
+
self._experiment_dict: ExperimentDict = self._get_or_create_by_uri(uri)
|
27
28
|
|
28
29
|
def __enter__(self):
|
29
30
|
Experiment._BIOLIB_EXPERIMENTS.append(self)
|
@@ -151,13 +152,33 @@ class Experiment:
|
|
151
152
|
|
152
153
|
return jobs
|
153
154
|
|
154
|
-
def rename(self,
|
155
|
-
|
155
|
+
def rename(self, name: Optional[str] = None, destination: Optional[str] = None) -> None:
|
156
|
+
if destination:
|
157
|
+
try:
|
158
|
+
account_id = api.client.get(path=f'/account/{destination}/').json()['uuid']
|
159
|
+
except HttpError as error:
|
160
|
+
if error.code == 404:
|
161
|
+
raise NotFound(f'Destination "{destination}" not found.') from None
|
162
|
+
else:
|
163
|
+
raise error
|
164
|
+
|
165
|
+
api.client.patch(
|
166
|
+
path=f'/apps/{self.uuid}/',
|
167
|
+
data={'account_id': account_id},
|
168
|
+
params={'resource_type': 'experiment'},
|
169
|
+
)
|
170
|
+
|
171
|
+
if name:
|
172
|
+
api.client.patch(path=f'/apps/{self.uuid}/', data={'name': name}, params={'resource_type': 'experiment'})
|
173
|
+
|
156
174
|
self._refetch_experiment_dict()
|
157
175
|
|
158
|
-
|
159
|
-
|
160
|
-
experiment_dict: ExperimentDict = api.client.post(
|
176
|
+
@staticmethod
|
177
|
+
def _get_or_create_by_uri(uri: str) -> ExperimentDict:
|
178
|
+
experiment_dict: ExperimentDict = api.client.post(
|
179
|
+
path='/experiments/',
|
180
|
+
data={'uri' if '/' in uri else 'name': uri},
|
181
|
+
).json()
|
161
182
|
return experiment_dict
|
162
183
|
|
163
184
|
def _refetch_experiment_dict(self) -> None:
|
@@ -3,7 +3,7 @@ README.md,sha256=_IH7pxFiqy2bIAmaVeA-iVTyUwWRjMIlfgtUbYTtmls,368
|
|
3
3
|
biolib/__init__.py,sha256=nfZvVkrHZLvjvvlAvFzhvem9NMfqgmw8NWaCH9HGzew,4045
|
4
4
|
biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
biolib/_internal/data_record/__init__.py,sha256=1Bk303i3rFet9veS56fIsrBYtT5X3n9vcsYMA6T6c5o,36
|
6
|
-
biolib/_internal/data_record/data_record.py,sha256=
|
6
|
+
biolib/_internal/data_record/data_record.py,sha256=NLzeyzqtzB9QOVUDcEiOn2WbMdMijbjZGYgy_p592_c,7372
|
7
7
|
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=hILu0TmFx-ZyDYbWPC4QEPogP0RRVEqwgJc8OEHYp50,1742
|
8
8
|
biolib/_internal/fuse_mount/__init__.py,sha256=B_tM6RM2dBw-vbpoHJC4X3tOAaN1H2RDvqYJOw3xFwg,55
|
9
9
|
biolib/_internal/fuse_mount/experiment_fuse_mount.py,sha256=08aUdEq_bvqLBft_gSLjOClKDy5sBnMts1RfJf7AP_U,7012
|
@@ -86,7 +86,7 @@ biolib/compute_node/webserver/webserver_types.py,sha256=Vmt1ZDecYhGBVEYWcW1DVxee
|
|
86
86
|
biolib/compute_node/webserver/webserver_utils.py,sha256=XWvwYPbWNR3qS0FYbLLp-MDDfVk0QdaAmg3xPrT0H2s,4234
|
87
87
|
biolib/compute_node/webserver/worker_thread.py,sha256=26tG73TADnOcXsAr7Iyf6smrLlCqB4x-vvmpUb8WqnA,11569
|
88
88
|
biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
89
|
-
biolib/experiments/experiment.py,sha256=
|
89
|
+
biolib/experiments/experiment.py,sha256=IMjnokTc9ZEKUjpsM_JnFolh9HsLbjXus_xKBb2ypJ8,7219
|
90
90
|
biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
|
91
91
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
92
92
|
biolib/jobs/job.py,sha256=aWKnf_2pYdr76gh3hxPiVs2iuXlpwZkKPTK81Pz4G2U,19072
|
@@ -109,8 +109,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
109
109
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
110
110
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
111
111
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
112
|
-
pybiolib-1.1.
|
113
|
-
pybiolib-1.1.
|
114
|
-
pybiolib-1.1.
|
115
|
-
pybiolib-1.1.
|
116
|
-
pybiolib-1.1.
|
112
|
+
pybiolib-1.1.2025.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.2025.dist-info/METADATA,sha256=6lmW6PO_BxMu1HXkuURGnOWspzomoeU21nIvSVBemDg,1508
|
114
|
+
pybiolib-1.1.2025.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.2025.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.2025.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|