pybiolib 1.1.2013__py3-none-any.whl → 1.1.2023__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/api/client.py +9 -2
- biolib/experiments/experiment.py +31 -6
- {pybiolib-1.1.2013.dist-info → pybiolib-1.1.2023.dist-info}/METADATA +1 -1
- {pybiolib-1.1.2013.dist-info → pybiolib-1.1.2023.dist-info}/RECORD +7 -7
- {pybiolib-1.1.2013.dist-info → pybiolib-1.1.2023.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.2013.dist-info → pybiolib-1.1.2023.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.2013.dist-info → pybiolib-1.1.2023.dist-info}/entry_points.txt +0 -0
biolib/api/client.py
CHANGED
@@ -42,13 +42,20 @@ class ApiClient(HttpClient):
|
|
42
42
|
url=self._get_absolute_url(path=path, query_params=None),
|
43
43
|
)
|
44
44
|
|
45
|
-
def patch(
|
45
|
+
def patch(
|
46
|
+
self,
|
47
|
+
path: str,
|
48
|
+
data: Dict,
|
49
|
+
headers: OptionalHeaders = None,
|
50
|
+
retries: int = 5,
|
51
|
+
params: Optional[Dict[str, Union[str, int]]] = None,
|
52
|
+
) -> HttpResponse:
|
46
53
|
return self.request(
|
47
54
|
data=data,
|
48
55
|
headers=self._get_headers(opt_headers=headers, authenticate=True),
|
49
56
|
method='PATCH',
|
50
57
|
retries=retries,
|
51
|
-
url=self._get_absolute_url(path=path, query_params=
|
58
|
+
url=self._get_absolute_url(path=path, query_params=params),
|
52
59
|
)
|
53
60
|
|
54
61
|
@staticmethod
|
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,9 +152,33 @@ class Experiment:
|
|
151
152
|
|
152
153
|
return jobs
|
153
154
|
|
154
|
-
def
|
155
|
-
|
156
|
-
|
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
|
+
|
174
|
+
self._refetch_experiment_dict()
|
175
|
+
|
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()
|
157
182
|
return experiment_dict
|
158
183
|
|
159
184
|
def _refetch_experiment_dict(self) -> None:
|
@@ -14,7 +14,7 @@ biolib/_internal/push_application.py,sha256=H1PGNtVJ0vRC0li39gFMpPpjm6QeZ8Ob-7cL
|
|
14
14
|
biolib/_internal/runtime.py,sha256=BnFvRWYnxPXCgOtfxupN255Zxx9Gw6oPZyzUIGODw3k,3060
|
15
15
|
biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
|
16
16
|
biolib/api/__init__.py,sha256=iIO8ZRdn7YDhY5cR47-Wo1YsNOK8H6RN6jn8yor5WJI,137
|
17
|
-
biolib/api/client.py,sha256
|
17
|
+
biolib/api/client.py,sha256=-8Rwe-3WLyRbod4i70nM9_t7PqC1NucrHwgbTxfCA18,3051
|
18
18
|
biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
|
19
19
|
biolib/app/app.py,sha256=8AvPYL1W2wxQ7t7BB2KeVU2WPrm3UL6vVuHPGs8g9L0,8388
|
20
20
|
biolib/app/search_apps.py,sha256=K4a41f5XIWth2BWI7OffASgIsD0ko8elCax8YL2igaY,1470
|
@@ -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.2023.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.2023.dist-info/METADATA,sha256=70NFyEQo2lxFDn7DMiflWXEjB58w7HtD0bQHgQ5ORDc,1508
|
114
|
+
pybiolib-1.1.2023.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.2023.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.2023.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|