pybiolib 1.1.2109__py3-none-any.whl → 1.1.2119__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.
@@ -0,0 +1 @@
1
+ from .resources import * # noqa: F403
@@ -0,0 +1,14 @@
1
+ from .typing import Optional, TypedDict
2
+
3
+
4
+ class ExperimentDict(TypedDict):
5
+ job_count: int
6
+ job_running_count: int
7
+
8
+
9
+ class ResourceDict(TypedDict):
10
+ created_at: str
11
+ experiment: Optional[ExperimentDict]
12
+ name: str
13
+ uri: str
14
+ uuid: str
@@ -0,0 +1,7 @@
1
+ import sys
2
+
3
+ # import and expose everything from the typing module
4
+ from typing import * # noqa:F403 pylint: disable=wildcard-import, unused-wildcard-import
5
+
6
+ if sys.version_info < (3, 8): # noqa: UP036
7
+ from typing_extensions import Literal, TypedDict # pylint: disable=unused-import
biolib/app/app.py CHANGED
@@ -56,6 +56,7 @@ class BioLibApp:
56
56
  result_prefix: Optional[str] = None,
57
57
  timeout: Optional[int] = None,
58
58
  notify: bool = False,
59
+ machine_count: Optional[int] = None,
59
60
  ) -> Job:
60
61
  if not experiment_id:
61
62
  experiment = Experiment.get_experiment_in_context()
@@ -85,6 +86,7 @@ class BioLibApp:
85
86
  override_command=override_command,
86
87
  result_prefix=result_prefix,
87
88
  timeout=timeout,
89
+ requested_machine_count=machine_count,
88
90
  )
89
91
  if blocking:
90
92
  # TODO: Deprecate utils.STREAM_STDOUT and always stream logs by simply calling job.stream_logs()
@@ -46,6 +46,7 @@ class BiolibJobApi:
46
46
  experiment_uuid: Optional[str] = None,
47
47
  timeout: Optional[int] = None,
48
48
  notify: bool = False,
49
+ requested_machine_count: Optional[int] = None,
49
50
  ):
50
51
  data = {
51
52
  'app_version_id': app_version_id,
@@ -73,6 +74,9 @@ class BiolibJobApi:
73
74
  'requested_machine': machine
74
75
  })
75
76
 
77
+ if requested_machine_count:
78
+ data.update({'requested_machine_count': requested_machine_count})
79
+
76
80
  if experiment_uuid:
77
81
  data['experiment_uuid'] = experiment_uuid
78
82
 
@@ -156,6 +160,7 @@ class BiolibJobApi:
156
160
  caller_job_uuid: Optional[str] = None,
157
161
  requested_timeout_seconds: Optional[int] = None,
158
162
  notify: bool = False,
163
+ requested_machine_count: Optional[int] = None,
159
164
  ) -> Dict:
160
165
  job_dict: Dict = biolib.api.client.post(
161
166
  path='/jobs/create_job_with_data/',
@@ -171,6 +176,7 @@ class BiolibJobApi:
171
176
  'client-version': BIOLIB_PACKAGE_VERSION,
172
177
  'experiment-uuid': experiment_uuid,
173
178
  'requested-machine': requested_machine,
179
+ 'requested-machine-count': str(requested_machine_count) if requested_machine_count else None,
174
180
  'result-name-prefix': result_name_prefix,
175
181
  'requested-timeout-seconds': str(requested_timeout_seconds) if requested_timeout_seconds else None,
176
182
  'notify': 'true' if notify else 'false',
@@ -1,6 +1,7 @@
1
1
  import time
2
2
  from collections import OrderedDict
3
3
 
4
+ import biolib._internal.types as _types
4
5
  from biolib import api
5
6
  from biolib._internal.http_client import HttpError
6
7
  from biolib.biolib_errors import BioLibError, NotFound
@@ -23,8 +24,11 @@ class Experiment:
23
24
  }
24
25
  )
25
26
 
26
- def __init__(self, uri: str):
27
- self._experiment_dict: ExperimentDict = self._get_or_create_by_uri(uri)
27
+ def __init__(self, uri: str, _experiment_dict: Optional[ExperimentDict] = None):
28
+ if not _experiment_dict:
29
+ self._experiment_dict: ExperimentDict = self._get_or_create_by_uri(uri)
30
+ else:
31
+ self._experiment_dict = _experiment_dict
28
32
 
29
33
  def __enter__(self):
30
34
  Experiment._BIOLIB_EXPERIMENTS.append(self)
@@ -62,6 +66,21 @@ class Experiment:
62
66
  title='Experiments',
63
67
  ).print_table()
64
68
 
69
+ @staticmethod
70
+ def get_by_uri(uri: str) -> 'Experiment':
71
+ resource_dict: _types.ResourceDict = api.client.get('/resources/', params={'uri': uri}).json()
72
+ if not resource_dict['experiment']:
73
+ raise ValueError('Resource from URI is not an experiment')
74
+
75
+ legacy_experiment_dict = ExperimentDict(
76
+ created_at=resource_dict['created_at'],
77
+ job_count=resource_dict['experiment']['job_count'],
78
+ job_running_count=resource_dict['experiment']['job_running_count'],
79
+ name=resource_dict['name'],
80
+ uuid=resource_dict['uuid'],
81
+ )
82
+ return Experiment(uri=resource_dict['uri'], _experiment_dict=legacy_experiment_dict)
83
+
65
84
  def wait(self) -> None:
66
85
  self._refetch_experiment_dict()
67
86
  while self._experiment_dict['job_running_count'] > 0:
biolib/jobs/job.py CHANGED
@@ -412,6 +412,7 @@ class Job:
412
412
  result_prefix: Optional[str] = None,
413
413
  timeout: Optional[int] = None,
414
414
  notify: bool = False,
415
+ requested_machine_count: Optional[int] = None,
415
416
  ) -> 'Job':
416
417
  if len(module_input_serialized) < 500_000:
417
418
  _job_dict = BiolibJobApi.create_job_with_data(
@@ -424,6 +425,7 @@ class Job:
424
425
  requested_machine=machine,
425
426
  requested_timeout_seconds=timeout,
426
427
  result_name_prefix=result_prefix,
428
+ requested_machine_count=requested_machine_count,
427
429
  )
428
430
  return Job(cast(JobDict, _job_dict))
429
431
 
@@ -435,6 +437,7 @@ class Job:
435
437
  notify=notify,
436
438
  override_command=override_command,
437
439
  timeout=timeout,
440
+ requested_machine_count=requested_machine_count,
438
441
  )
439
442
  JobStorage.upload_module_input(job=job_dict, module_input_serialized=module_input_serialized)
440
443
  cloud_job = BiolibJobApi.create_cloud_job(job_id=job_dict['public_id'], result_name_prefix=result_prefix)
biolib/typing_utils.py CHANGED
@@ -1,7 +1,2 @@
1
- import sys
2
-
3
- # import and expose everything from the typing module
4
- from typing import * # pylint: disable=wildcard-import, unused-wildcard-import
5
-
6
- if sys.version_info < (3, 8):
7
- from typing_extensions import TypedDict, Literal # pylint: disable=unused-import
1
+ # TODO: Deprecate and later remove this file
2
+ from biolib._internal.types.typing import * # pylint: disable=wildcard-import, unused-wildcard-import
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.2109
3
+ Version: 1.1.2119
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -16,19 +16,22 @@ biolib/_internal/libs/__init__.py,sha256=Jdf4tNPqe_oIIf6zYml6TiqhL_02Vyqwge6IELr
16
16
  biolib/_internal/libs/fusepy/__init__.py,sha256=AWDzNFS-XV_5yKb0Qx7kggIhPzq1nj_BZS5y2Nso08k,41944
17
17
  biolib/_internal/push_application.py,sha256=8P7eXvySn7CRp5XBDkO3xjTGixS8g7-jD-_iwzM_XDI,10020
18
18
  biolib/_internal/runtime.py,sha256=9pZ3s3L7LGxdqOgnHh1KK3Jjyn_9MjhQmKHI-6hMT3U,448
19
+ biolib/_internal/types/__init__.py,sha256=h2I2aupN01HbhBelL-qQa8FLuXiH1tB3kKl8dPdhmnc,39
20
+ biolib/_internal/types/resources.py,sha256=LlxuiesDDv3TvfEmz_BCCxH0V650bNHtS_LpBMA25T4,256
21
+ biolib/_internal/types/typing.py,sha256=D4EKKEe7kDx0K6lJi-H_XLtk-8w6nu2fdqn9bvzI-Xo,288
19
22
  biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
20
23
  biolib/_runtime/runtime.py,sha256=zy9HrE4X5hBqm8doUHkckyflquSBDSXV3REhT2MQGas,2767
21
24
  biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
22
25
  biolib/api/client.py,sha256=9MD1qI52BnRC_QSydFGjyFquwFw0R9dkDfUrjUouuHQ,3490
23
26
  biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
24
- biolib/app/app.py,sha256=8AvPYL1W2wxQ7t7BB2KeVU2WPrm3UL6vVuHPGs8g9L0,8388
27
+ biolib/app/app.py,sha256=P2RwaDAskUHzlciuTJUroqUocRwoyOLT6YbgMyCRRDI,8484
25
28
  biolib/app/search_apps.py,sha256=K4a41f5XIWth2BWI7OffASgIsD0ko8elCax8YL2igaY,1470
26
29
  biolib/biolib_api_client/__init__.py,sha256=E5EMa19wJoblwSdQPYrxc_BtIeRsAuO0L_jQweWw-Yk,182
27
30
  biolib/biolib_api_client/api_client.py,sha256=krlSRmmAwtdMMyN1XzQhh1gihB1ERSIVslWQ-dqI1yU,7188
28
31
  biolib/biolib_api_client/app_types.py,sha256=FxSr4UqfnMhLe34p8bm02wsC3g1Jz8iaing5tRKDOQI,2442
29
32
  biolib/biolib_api_client/auth.py,sha256=kjm0ZHnH3I8so3su2sZbBxNHYp-ZUdrZ5lwQ0K36RSw,949
30
33
  biolib/biolib_api_client/biolib_app_api.py,sha256=DndlVxrNTes6DOaWyMINLGZQCRMWVvR7gwt5HVlyf5Y,4240
31
- biolib/biolib_api_client/biolib_job_api.py,sha256=IpFahcRzm7GNy8DJ-XHYe-x7r4Voba8o22IXw5puHn8,6782
34
+ biolib/biolib_api_client/biolib_job_api.py,sha256=7bKfav3-12ewXkEUoLdCmbWdebW8148kxfGJW9SsXZI,7125
32
35
  biolib/biolib_api_client/common_types.py,sha256=RH-1KNHqUF-EkTpfPOSTt5Mq1GPdfju_cqXDesscO1I,123
33
36
  biolib/biolib_api_client/job_types.py,sha256=Dl4NhU2xpgpXV-7YIoDf6WL63SLR5bni55OX8x5539M,1300
34
37
  biolib/biolib_api_client/lfs_types.py,sha256=joZWP6-sa5_Ug_6xIp5fHAgEo_bqLE3rbleQocZtDcg,339
@@ -91,10 +94,10 @@ biolib/compute_node/webserver/webserver_types.py,sha256=2t8EaFKESnves3BA_NBdnS2y
91
94
  biolib/compute_node/webserver/webserver_utils.py,sha256=XWvwYPbWNR3qS0FYbLLp-MDDfVk0QdaAmg3xPrT0H2s,4234
92
95
  biolib/compute_node/webserver/worker_thread.py,sha256=26tG73TADnOcXsAr7Iyf6smrLlCqB4x-vvmpUb8WqnA,11569
93
96
  biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
- biolib/experiments/experiment.py,sha256=IMjnokTc9ZEKUjpsM_JnFolh9HsLbjXus_xKBb2ypJ8,7219
97
+ biolib/experiments/experiment.py,sha256=o2gXMJVwK2SFljZ9RdTYFRH3jGKJmg3P39oERhEnZMQ,8126
95
98
  biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
96
99
  biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
97
- biolib/jobs/job.py,sha256=npnARoP408SXD2UqyzFRJYdEJsP_gHoBh2xQkNegYqg,18884
100
+ biolib/jobs/job.py,sha256=aJck0zl6QTE-70pkHY9tKDctchdJyA-YaCIozrlqGkA,19065
98
101
  biolib/jobs/job_result.py,sha256=rALHiKYNaC9lHi_JJqBob1RubzNLwG9Z386kwRJjd2M,5885
99
102
  biolib/jobs/types.py,sha256=qhadtH2KDC2WUOOqPiwke0YgtQY4FtuB71Stekq1k48,970
100
103
  biolib/runtime/__init__.py,sha256=Fg2ZIAmUegurLKagpBNfRgLcOwR2VZSmXQpb-ryRwI0,505
@@ -102,7 +105,7 @@ biolib/sdk/__init__.py,sha256=qJ_V_Edxolzi4VBQCrvem5lYIkJ0FVH3VZepSDuXjTc,1895
102
105
  biolib/tables.py,sha256=acH7VjwAbadLo8P84FSnKEZxCTVsF5rEg9VPuxElNs8,872
103
106
  biolib/templates/__init__.py,sha256=Yx62sSyDCDesRQDQgmbDsLpfgEh93fWE8r9u4g2azXk,36
104
107
  biolib/templates/example_app.py,sha256=EB3E3RT4SeO_ii5nVQqJpi5KDGNE_huF1ub-e5ZFveE,715
105
- biolib/typing_utils.py,sha256=krMhxB3SedVQA3HXIrC7DBXWpHKWN5JNmXGcSrrysOc,263
108
+ biolib/typing_utils.py,sha256=ntzrlyTkUaO2OtccLYzCAGztGdca0WT5fikJUmSkT-Y,148
106
109
  biolib/user/__init__.py,sha256=Db5wtxLfFz3ID9TULSSTo77csw9tO6RtxMRvV5cqKEE,39
107
110
  biolib/user/sign_in.py,sha256=q-E2B3wLVwPU5plbITJXP4GDWWUzUcDpYu_y8BShNQ8,2039
108
111
  biolib/utils/__init__.py,sha256=fwjciJyJicvYyZcVTzfDBgD0SKY13DeXqvTeG4qZIy8,5548
@@ -111,8 +114,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
111
114
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
112
115
  biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
113
116
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
114
- pybiolib-1.1.2109.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
115
- pybiolib-1.1.2109.dist-info/METADATA,sha256=Ib3gPLhMCJEEmlmAf7rgaOg4ZR2x1pQef1XCOCryito,1508
116
- pybiolib-1.1.2109.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
117
- pybiolib-1.1.2109.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
118
- pybiolib-1.1.2109.dist-info/RECORD,,
117
+ pybiolib-1.1.2119.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
118
+ pybiolib-1.1.2119.dist-info/METADATA,sha256=H_-CG3QcTCBRdKmXtXeAfdOOaCNQMNz7AQO3YdJHAGQ,1508
119
+ pybiolib-1.1.2119.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
120
+ pybiolib-1.1.2119.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
121
+ pybiolib-1.1.2119.dist-info/RECORD,,