pybiolib 1.2.138.dev1__py3-none-any.whl → 1.2.141.dev1__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/__init__.py +2 -2
- biolib/jobs/job.py +24 -6
- {pybiolib-1.2.138.dev1.dist-info → pybiolib-1.2.141.dev1.dist-info}/METADATA +1 -1
- {pybiolib-1.2.138.dev1.dist-info → pybiolib-1.2.141.dev1.dist-info}/RECORD +7 -7
- {pybiolib-1.2.138.dev1.dist-info → pybiolib-1.2.141.dev1.dist-info}/LICENSE +0 -0
- {pybiolib-1.2.138.dev1.dist-info → pybiolib-1.2.141.dev1.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.138.dev1.dist-info → pybiolib-1.2.141.dev1.dist-info}/entry_points.txt +0 -0
biolib/__init__.py
CHANGED
@@ -49,8 +49,8 @@ def get_data_record(uri: str) -> _DataRecord:
|
|
49
49
|
return _DataRecord.get_by_uri(uri)
|
50
50
|
|
51
51
|
|
52
|
-
def fetch_jobs(count: int = 25) -> List[_Job]:
|
53
|
-
return _Job.fetch_jobs(count)
|
52
|
+
def fetch_jobs(count: int = 25, status: Optional[str] = None) -> List[_Job]:
|
53
|
+
return _Job.fetch_jobs(count, status)
|
54
54
|
|
55
55
|
|
56
56
|
def fetch_data_records(uri: Optional[str] = None, count: Optional[int] = None) -> List[_DataRecord]:
|
biolib/jobs/job.py
CHANGED
@@ -22,7 +22,7 @@ from biolib.compute_node.utils import SystemExceptionCodeMap, SystemExceptionCod
|
|
22
22
|
from biolib.jobs.job_result import JobResult
|
23
23
|
from biolib.jobs.types import CloudJobDict, CloudJobStartedDict, JobDict
|
24
24
|
from biolib.tables import BioLibTable
|
25
|
-
from biolib.typing_utils import Dict, List, Optional, cast
|
25
|
+
from biolib.typing_utils import Dict, List, Optional, Union, cast
|
26
26
|
from biolib.utils import IS_RUNNING_IN_NOTEBOOK
|
27
27
|
from biolib.utils.app_uri import parse_app_uri
|
28
28
|
|
@@ -232,8 +232,8 @@ class Job:
|
|
232
232
|
self._result = JobResult(job_uuid=self._uuid, job_auth_token=self._auth_token, module_output=module_output)
|
233
233
|
|
234
234
|
@staticmethod
|
235
|
-
def fetch_jobs(count: int) -> List['Job']:
|
236
|
-
job_dicts = Job._get_job_dicts(count)
|
235
|
+
def fetch_jobs(count: int, status: Optional[str] = None) -> List['Job']:
|
236
|
+
job_dicts = Job._get_job_dicts(count, status)
|
237
237
|
return [Job(job_dict) for job_dict in job_dicts]
|
238
238
|
|
239
239
|
@staticmethod
|
@@ -242,9 +242,27 @@ class Job:
|
|
242
242
|
BioLibTable(columns_to_row_map=Job.table_columns_to_row_map, rows=job_dicts, title='Jobs').print_table()
|
243
243
|
|
244
244
|
@staticmethod
|
245
|
-
def _get_job_dicts(count: int) -> List['JobDict']:
|
246
|
-
|
247
|
-
|
245
|
+
def _get_job_dicts(count: int, status: Optional[str] = None) -> List['JobDict']:
|
246
|
+
job_states = ['in_progress', 'completed', 'failed', 'cancelled']
|
247
|
+
if status is not None and status not in job_states:
|
248
|
+
raise Exception('Invalid status filter')
|
249
|
+
|
250
|
+
page_size = min(count, 1_000)
|
251
|
+
params: Dict[str, Union[str, int]] = dict(page_size=page_size)
|
252
|
+
if status:
|
253
|
+
params['state'] = status
|
254
|
+
|
255
|
+
api_path = '/jobs/'
|
256
|
+
response = api.client.get(api_path, params=params).json()
|
257
|
+
jobs = [job_dict for job_dict in response['results']]
|
258
|
+
|
259
|
+
for page_number in range(2, response['page_count'] + 1):
|
260
|
+
page_response = api.client.get(path=api_path, params=dict(**params, page=page_number)).json()
|
261
|
+
jobs.extend([job_dict for job_dict in page_response['results']])
|
262
|
+
if len(jobs) >= count:
|
263
|
+
break
|
264
|
+
|
265
|
+
return jobs
|
248
266
|
|
249
267
|
@staticmethod
|
250
268
|
def _get_job_dict(uuid: str, auth_token: Optional[str] = None) -> JobDict:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
2
2
|
PYPI_README.md,sha256=_IH7pxFiqy2bIAmaVeA-iVTyUwWRjMIlfgtUbYTtmls,368
|
3
|
-
biolib/__init__.py,sha256=
|
3
|
+
biolib/__init__.py,sha256=4Rfa0AJKztqkCG5D67kFgSwdOUiBTa5HkAzIOqHNREU,4431
|
4
4
|
biolib/_data_record/data_record.py,sha256=zVAhFU1RLI1-ptoQ_l639RNwrMANXV9j75yXHvB7dtA,10950
|
5
5
|
biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
biolib/_internal/data_record/__init__.py,sha256=fGdME6JGRU_2VxpJbYpGXYndjN-feUkmKY4fuMyq3cg,76
|
@@ -102,7 +102,7 @@ biolib/compute_node/webserver/worker_thread.py,sha256=GRRBUqXdMKvbjyLQhYlqGIbFKe
|
|
102
102
|
biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
103
103
|
biolib/experiments/experiment.py,sha256=jIRixmQm3Gq9YdJ3I0-rE1vFukXqq6U4zXehFOJ1yZk,7614
|
104
104
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
105
|
-
biolib/jobs/job.py,sha256=
|
105
|
+
biolib/jobs/job.py,sha256=ej-dxt1hMBQXzTfUZ2SLqIV8dtTbMSMn_q2rjIA7oN4,19903
|
106
106
|
biolib/jobs/job_result.py,sha256=rALHiKYNaC9lHi_JJqBob1RubzNLwG9Z386kwRJjd2M,5885
|
107
107
|
biolib/jobs/types.py,sha256=qhadtH2KDC2WUOOqPiwke0YgtQY4FtuB71Stekq1k48,970
|
108
108
|
biolib/runtime/__init__.py,sha256=MlRepA11n2H-3plB5rzWyyHK2JmP6PiaP3i6x3vt0mg,506
|
@@ -119,8 +119,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
119
119
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
120
120
|
biolib/utils/seq_util.py,sha256=WJnU9vZdwY8RHXvzATyV80OXzyJ7w9EkG33Tna9Nr6A,5698
|
121
121
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
122
|
-
pybiolib-1.2.
|
123
|
-
pybiolib-1.2.
|
124
|
-
pybiolib-1.2.
|
125
|
-
pybiolib-1.2.
|
126
|
-
pybiolib-1.2.
|
122
|
+
pybiolib-1.2.141.dev1.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
123
|
+
pybiolib-1.2.141.dev1.dist-info/METADATA,sha256=9NEHC1fbAZuf_mpTlZyUtdPhEGFvBkhcyKwWzxugvfI,1512
|
124
|
+
pybiolib-1.2.141.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
125
|
+
pybiolib-1.2.141.dev1.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
126
|
+
pybiolib-1.2.141.dev1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|