pybiolib 1.2.740__py3-none-any.whl → 1.2.749__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/types/experiment.py +9 -8
- biolib/_internal/types/resource.py +2 -2
- biolib/_internal/types/result.py +4 -0
- biolib/experiments/experiment.py +30 -9
- {pybiolib-1.2.740.dist-info → pybiolib-1.2.749.dist-info}/METADATA +1 -1
- {pybiolib-1.2.740.dist-info → pybiolib-1.2.749.dist-info}/RECORD +9 -9
- {pybiolib-1.2.740.dist-info → pybiolib-1.2.749.dist-info}/LICENSE +0 -0
- {pybiolib-1.2.740.dist-info → pybiolib-1.2.749.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.740.dist-info → pybiolib-1.2.749.dist-info}/entry_points.txt +0 -0
@@ -11,20 +11,21 @@ class ResultCounts(TypedDict):
|
|
11
11
|
total: int
|
12
12
|
|
13
13
|
|
14
|
-
class
|
14
|
+
class DeprecatedExperimentDict(TypedDict):
|
15
|
+
# Note: fields on this TypedDict are deprecated
|
16
|
+
job_count: int
|
17
|
+
job_running_count: int
|
18
|
+
|
19
|
+
|
20
|
+
class ExperimentDict(DeprecatedExperimentDict):
|
15
21
|
uuid: Optional[str]
|
16
22
|
name: Optional[str]
|
23
|
+
created_at: Optional[str]
|
17
24
|
finished_at: Optional[str]
|
18
|
-
first_created_at: Optional[str]
|
19
25
|
last_created_at: Optional[str]
|
20
26
|
last_created_result: Optional[ResultDict]
|
21
27
|
result_counts: ResultCounts
|
22
28
|
|
23
29
|
|
24
|
-
class
|
25
|
-
job_count: int
|
26
|
-
job_running_count: int
|
27
|
-
|
28
|
-
|
29
|
-
class ExperimentDetailedDict(ExperimentSlimDict):
|
30
|
+
class ExperimentDetailedDict(ExperimentDict):
|
30
31
|
pass
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from .app import AppSlimDict
|
2
2
|
from .data_record import DataRecordSlimDict
|
3
|
-
from .experiment import
|
3
|
+
from .experiment import DeprecatedExperimentDict
|
4
4
|
from .typing import Optional, TypedDict
|
5
5
|
|
6
6
|
|
@@ -15,4 +15,4 @@ class ResourceDict(TypedDict):
|
|
15
15
|
class ResourceDetailedDict(ResourceDict):
|
16
16
|
app: Optional[AppSlimDict]
|
17
17
|
data_record: Optional[DataRecordSlimDict]
|
18
|
-
experiment: Optional[
|
18
|
+
experiment: Optional[DeprecatedExperimentDict]
|
biolib/_internal/types/result.py
CHANGED
biolib/experiments/experiment.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import time
|
2
2
|
from collections import OrderedDict
|
3
3
|
|
4
|
-
import biolib._internal.types as _types
|
5
4
|
from biolib import api
|
5
|
+
from biolib._internal.types.experiment import DeprecatedExperimentDict, ExperimentDict
|
6
|
+
from biolib._internal.types.resource import ResourceDetailedDict
|
6
7
|
from biolib.biolib_errors import BioLibError
|
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, uri: str, _resource_dict: Optional[
|
26
|
-
self._resource_dict:
|
26
|
+
def __init__(self, uri: str, _resource_dict: Optional[ResourceDetailedDict] = None):
|
27
|
+
self._resource_dict: ResourceDetailedDict = _resource_dict or self._get_or_create_resource_dict(uri)
|
27
28
|
|
28
29
|
def __enter__(self):
|
29
30
|
Experiment._BIOLIB_EXPERIMENTS.append(self)
|
@@ -50,7 +51,7 @@ class Experiment:
|
|
50
51
|
return self._resource_dict['uri']
|
51
52
|
|
52
53
|
@property
|
53
|
-
def _experiment_dict(self) ->
|
54
|
+
def _experiment_dict(self) -> DeprecatedExperimentDict:
|
54
55
|
if not self._resource_dict['experiment']:
|
55
56
|
raise ValueError(f'Resource {self.uri} is not an Experiment')
|
56
57
|
|
@@ -65,7 +66,8 @@ class Experiment:
|
|
65
66
|
# Prints a table listing info about experiments accessible to the user
|
66
67
|
@staticmethod
|
67
68
|
def show_experiments(count: int = 25) -> None:
|
68
|
-
|
69
|
+
pagniated_response = api.client.get(path='/experiments/', params={'page_size': str(count)}).json()
|
70
|
+
experiment_dicts: List[ExperimentDict] = pagniated_response['results']
|
69
71
|
BioLibTable(
|
70
72
|
columns_to_row_map=Experiment._table_columns_to_row_map,
|
71
73
|
rows=experiment_dicts,
|
@@ -75,7 +77,7 @@ class Experiment:
|
|
75
77
|
@staticmethod
|
76
78
|
def get_by_uri(uri: str) -> 'Experiment':
|
77
79
|
query_param_key = 'uri' if '/' in uri else 'name'
|
78
|
-
resource_dict:
|
80
|
+
resource_dict: ResourceDetailedDict = api.client.get('/resource/', params={query_param_key: uri}).json()
|
79
81
|
if not resource_dict['experiment']:
|
80
82
|
raise ValueError(f'Resource {uri} is not an experiment')
|
81
83
|
|
@@ -195,20 +197,39 @@ class Experiment:
|
|
195
197
|
|
196
198
|
return jobs
|
197
199
|
|
200
|
+
def get_results(self, status: Optional[str] = None) -> List[Job]:
|
201
|
+
r"""Get a list of results in this experiment, optionally filtered by status.
|
202
|
+
|
203
|
+
Args:
|
204
|
+
status (str, optional): Filter results by status. One of:
|
205
|
+
'in_progress', 'completed', 'failed', 'cancelled'
|
206
|
+
|
207
|
+
Returns:
|
208
|
+
List[Job]: List of result objects in this experiment
|
209
|
+
|
210
|
+
Example::
|
211
|
+
|
212
|
+
>>> # Get all results in the experiment
|
213
|
+
>>> results = experiment.get_results()
|
214
|
+
>>> # Get only completed results
|
215
|
+
>>> completed_results = experiment.get_results(status='completed')
|
216
|
+
"""
|
217
|
+
return self.get_jobs(status=status)
|
218
|
+
|
198
219
|
def rename(self, destination: str) -> None:
|
199
220
|
api.client.patch(f'/resources/{self.uuid}/', data={'uri': destination})
|
200
221
|
self._refetch()
|
201
222
|
|
202
223
|
@staticmethod
|
203
|
-
def _get_resource_dict_by_uuid(uuid: str) ->
|
204
|
-
resource_dict:
|
224
|
+
def _get_resource_dict_by_uuid(uuid: str) -> ResourceDetailedDict:
|
225
|
+
resource_dict: ResourceDetailedDict = api.client.get(f'/resources/{uuid}/').json()
|
205
226
|
if not resource_dict['experiment']:
|
206
227
|
raise ValueError('Resource from URI is not an experiment')
|
207
228
|
|
208
229
|
return resource_dict
|
209
230
|
|
210
231
|
@staticmethod
|
211
|
-
def _get_or_create_resource_dict(uri: str) ->
|
232
|
+
def _get_or_create_resource_dict(uri: str) -> ResourceDetailedDict:
|
212
233
|
response_dict = api.client.post(path='/experiments/', data={'uri' if '/' in uri else 'name': uri}).json()
|
213
234
|
return Experiment._get_resource_dict_by_uuid(uuid=response_dict['uuid'])
|
214
235
|
|
@@ -25,12 +25,12 @@ biolib/_internal/tree_utils.py,sha256=_Q_6_NDtIiROcefymqxEVddjqti6Mt3OZ4U0GcDW61
|
|
25
25
|
biolib/_internal/types/__init__.py,sha256=WvtlSHh77QhYVTLeRpoPAzqvByLzbEPf_ZqYGHFlQug,247
|
26
26
|
biolib/_internal/types/app.py,sha256=Mz2QGD_jESX-K9JYnLWPo4YA__Q_1FQQTk9pvidCohU,118
|
27
27
|
biolib/_internal/types/data_record.py,sha256=9r_vdhVs60YTnzU4XQFXfDrfS2P2MqD3BH2xa7lk6ck,852
|
28
|
-
biolib/_internal/types/experiment.py,sha256=
|
28
|
+
biolib/_internal/types/experiment.py,sha256=2SbCLSwgLglmQgyUHYb5SvO0Cfsgs-f3jqao9--Z_sY,682
|
29
29
|
biolib/_internal/types/file_node.py,sha256=T6BIqo662f3nwMBRqtBHYsg6YuuUaKpiokHcVjv9_ME,283
|
30
|
-
biolib/_internal/types/resource.py,sha256=
|
30
|
+
biolib/_internal/types/resource.py,sha256=LQnIYBR8Fi7zvnA5vBpzcL2c6ZjpaKNTe38hXck82k0,449
|
31
31
|
biolib/_internal/types/resource_permission.py,sha256=ZE7eokpzswAiqe4GdpdxdZ6_jl0LdiRD9gP81I8C3fY,292
|
32
32
|
biolib/_internal/types/resource_version.py,sha256=cU0YFHqxO-wX_Y6CoeK0Iei61gFwVoyR_kPOSTQ4mCs,304
|
33
|
-
biolib/_internal/types/result.py,sha256=
|
33
|
+
biolib/_internal/types/result.py,sha256=MesSTBXCkaw8HydXgHf1OKGVLzsxhZ1KV5z4w-VI-0M,231
|
34
34
|
biolib/_internal/types/typing.py,sha256=qrsk8hHcGEbDpU1QQFzHAKnhQxkMe7uJ6pxHeAnfv1Y,414
|
35
35
|
biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
|
36
36
|
biolib/_internal/utils/multinode.py,sha256=-J3PEAK3NaOwCn--5T7vWHkA3yu5w9QhmuhkQcH-2wY,8229
|
@@ -110,7 +110,7 @@ biolib/compute_node/webserver/webserver_types.py,sha256=2t8EaFKESnves3BA_NBdnS2y
|
|
110
110
|
biolib/compute_node/webserver/webserver_utils.py,sha256=XWvwYPbWNR3qS0FYbLLp-MDDfVk0QdaAmg3xPrT0H2s,4234
|
111
111
|
biolib/compute_node/webserver/worker_thread.py,sha256=7uD9yQPhePYvP2HCJ27EeZ_h6psfIWFgqm1RHZxzobs,12483
|
112
112
|
biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
|
-
biolib/experiments/experiment.py,sha256=
|
113
|
+
biolib/experiments/experiment.py,sha256=OTUPOY_F5qo22oFi3acnRMmG0pcmP6ZfoQncFkcTYDQ,9478
|
114
114
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
115
115
|
biolib/jobs/job.py,sha256=X33-s9u8x3uZI0x_fSDgEFAW0ke-8Qi96M-VB-W29MA,26703
|
116
116
|
biolib/jobs/job_result.py,sha256=rALHiKYNaC9lHi_JJqBob1RubzNLwG9Z386kwRJjd2M,5885
|
@@ -130,8 +130,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
130
130
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
131
131
|
biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
|
132
132
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
133
|
-
pybiolib-1.2.
|
134
|
-
pybiolib-1.2.
|
135
|
-
pybiolib-1.2.
|
136
|
-
pybiolib-1.2.
|
137
|
-
pybiolib-1.2.
|
133
|
+
pybiolib-1.2.749.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
134
|
+
pybiolib-1.2.749.dist-info/METADATA,sha256=hAUHVeH2pyZYFKHncVnsKqV6m2q0J29O_Qs2PUFyrIM,1570
|
135
|
+
pybiolib-1.2.749.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
136
|
+
pybiolib-1.2.749.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
137
|
+
pybiolib-1.2.749.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|