pybiolib 1.2.1247__py3-none-any.whl → 1.2.1295__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.
Potentially problematic release.
This version of pybiolib might be problematic. Click here for more details.
- biolib/__init__.py +33 -10
- biolib/_internal/utils/job_url.py +33 -0
- biolib/jobs/job.py +2 -0
- biolib/jobs/types.py +1 -0
- {pybiolib-1.2.1247.dist-info → pybiolib-1.2.1295.dist-info}/METADATA +1 -1
- {pybiolib-1.2.1247.dist-info → pybiolib-1.2.1295.dist-info}/RECORD +9 -8
- {pybiolib-1.2.1247.dist-info → pybiolib-1.2.1295.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.1247.dist-info → pybiolib-1.2.1295.dist-info}/entry_points.txt +0 -0
- {pybiolib-1.2.1247.dist-info → pybiolib-1.2.1295.dist-info}/licenses/LICENSE +0 -0
biolib/__init__.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# ruff: noqa: I001
|
|
1
2
|
# Imports to hide
|
|
2
3
|
import os
|
|
3
4
|
from urllib.parse import urlparse as _urlparse
|
|
@@ -15,6 +16,7 @@ from biolib.jobs.job import Result as _Result
|
|
|
15
16
|
from biolib import user as _user
|
|
16
17
|
from biolib.typing_utils import List, Optional, cast as _cast
|
|
17
18
|
from biolib._data_record.data_record import DataRecord as _DataRecord
|
|
19
|
+
from biolib._internal.utils.job_url import parse_result_id_or_url as _parse_result_id_or_url
|
|
18
20
|
|
|
19
21
|
import biolib.api
|
|
20
22
|
import biolib.app
|
|
@@ -22,7 +24,6 @@ import biolib.cli
|
|
|
22
24
|
import biolib.sdk
|
|
23
25
|
import biolib.utils
|
|
24
26
|
|
|
25
|
-
|
|
26
27
|
# ------------------------------------ Function definitions for public Python API ------------------------------------
|
|
27
28
|
|
|
28
29
|
|
|
@@ -83,43 +84,65 @@ def search(
|
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
def get_job(job_id: str, job_token: Optional[str] = None) -> _Result:
|
|
86
|
-
r"""Get a job by its ID.
|
|
87
|
+
r"""Get a job by its ID or full URL.
|
|
87
88
|
|
|
88
89
|
Args:
|
|
89
|
-
job_id (str): The UUID of the job to retrieve
|
|
90
|
+
job_id (str): The UUID of the job to retrieve, or a full URL to the job.
|
|
91
|
+
Can be either:
|
|
92
|
+
- Job UUID (e.g., 'abc123')
|
|
93
|
+
- Full URL (e.g., 'https://biolib.com/result/abc123/?token=xyz789')
|
|
94
|
+
- Full URL with token parameter (e.g., 'biolib.com/result/abc123/token=xyz789')
|
|
90
95
|
job_token (str, optional): Authentication token for accessing the job.
|
|
91
96
|
Only needed for jobs that aren't owned by the current user.
|
|
97
|
+
If the URL contains a token, this parameter is ignored.
|
|
92
98
|
|
|
93
99
|
Returns:
|
|
94
100
|
Job: The job object
|
|
95
101
|
|
|
96
102
|
Example::
|
|
97
103
|
|
|
104
|
+
>>> # Get by UUID
|
|
98
105
|
>>> job = biolib.get_job('abc123')
|
|
99
|
-
>>> #
|
|
106
|
+
>>> # Get with explicit token
|
|
100
107
|
>>> job = biolib.get_job('abc123', job_token='xyz789')
|
|
108
|
+
>>> # Get by full URL with token
|
|
109
|
+
>>> job = biolib.get_job('https://biolib.com/result/abc123/?token=xyz789')
|
|
110
|
+
>>> # Get by URL with inline token format
|
|
111
|
+
>>> job = biolib.get_job('biolib.com/result/abc123/token=xyz789')
|
|
101
112
|
"""
|
|
102
|
-
|
|
113
|
+
uuid, token = _parse_result_id_or_url(job_id, job_token)
|
|
114
|
+
return _Result.create_from_uuid(uuid=uuid, auth_token=token)
|
|
103
115
|
|
|
104
116
|
|
|
105
117
|
def get_result(result_id: str, result_token: Optional[str] = None) -> _Result:
|
|
106
|
-
r"""Get a result by its ID.
|
|
118
|
+
r"""Get a result by its ID or full URL.
|
|
107
119
|
|
|
108
120
|
Args:
|
|
109
|
-
result_id (str): The UUID of the result to retrieve
|
|
121
|
+
result_id (str): The UUID of the result to retrieve, or a full URL to the result.
|
|
122
|
+
Can be either:
|
|
123
|
+
- Result UUID (e.g., 'abc123')
|
|
124
|
+
- Full URL (e.g., 'https://biolib.com/result/abc123/?token=xyz789')
|
|
125
|
+
- Full URL with token parameter (e.g., 'biolib.com/result/abc123/token=xyz789')
|
|
110
126
|
result_token (str, optional): Authentication token for accessing the result.
|
|
111
|
-
Only needed for
|
|
127
|
+
Only needed for results that aren't owned by the current user.
|
|
128
|
+
If the URL contains a token, this parameter is ignored.
|
|
112
129
|
|
|
113
130
|
Returns:
|
|
114
131
|
Result: The result object
|
|
115
132
|
|
|
116
133
|
Example::
|
|
117
134
|
|
|
135
|
+
>>> # Get by UUID
|
|
118
136
|
>>> result = biolib.get_result('abc123')
|
|
119
|
-
>>> #
|
|
137
|
+
>>> # Get with explicit token
|
|
120
138
|
>>> result = biolib.get_result('abc123', result_token='xyz789')
|
|
139
|
+
>>> # Get by full URL with token
|
|
140
|
+
>>> result = biolib.get_result('https://biolib.com/result/abc123/?token=xyz789')
|
|
141
|
+
>>> # Get by URL with inline token format
|
|
142
|
+
>>> result = biolib.get_result('biolib.com/result/abc123/token=xyz789')
|
|
121
143
|
"""
|
|
122
|
-
|
|
144
|
+
uuid, token = _parse_result_id_or_url(result_id, result_token)
|
|
145
|
+
return _Result.create_from_uuid(uuid=uuid, auth_token=token)
|
|
123
146
|
|
|
124
147
|
|
|
125
148
|
def get_data_record(uri: str) -> _DataRecord:
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from urllib.parse import urlparse
|
|
3
|
+
|
|
4
|
+
import biolib.utils
|
|
5
|
+
from biolib.typing_utils import Optional, Tuple
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def parse_result_id_or_url(result_id_or_url: str, default_token: Optional[str] = None) -> Tuple[str, Optional[str]]:
|
|
9
|
+
result_id_or_url = result_id_or_url.strip()
|
|
10
|
+
|
|
11
|
+
if '/' not in result_id_or_url:
|
|
12
|
+
return (result_id_or_url, default_token)
|
|
13
|
+
|
|
14
|
+
if not result_id_or_url.startswith('http://') and not result_id_or_url.startswith('https://'):
|
|
15
|
+
result_id_or_url = 'https://' + result_id_or_url
|
|
16
|
+
|
|
17
|
+
parsed_url = urlparse(result_id_or_url)
|
|
18
|
+
|
|
19
|
+
if biolib.utils.BIOLIB_BASE_URL:
|
|
20
|
+
expected_base = urlparse(biolib.utils.BIOLIB_BASE_URL)
|
|
21
|
+
if parsed_url.scheme != expected_base.scheme or parsed_url.netloc != expected_base.netloc:
|
|
22
|
+
raise ValueError(f'URL must start with {biolib.utils.BIOLIB_BASE_URL}, got: {result_id_or_url}')
|
|
23
|
+
|
|
24
|
+
pattern = r'/results?/(?P<uuid>[a-f0-9-]+)/?(?:\?token=(?P<token>[^&]+))?'
|
|
25
|
+
match = re.search(pattern, result_id_or_url, re.IGNORECASE)
|
|
26
|
+
|
|
27
|
+
if not match:
|
|
28
|
+
raise ValueError(f'URL must be in format <base_url>/results/<UUID>/?token=<token>, got: {result_id_or_url}')
|
|
29
|
+
|
|
30
|
+
uuid = match.group('uuid')
|
|
31
|
+
token = match.group('token') or default_token
|
|
32
|
+
|
|
33
|
+
return (uuid, token)
|
biolib/jobs/job.py
CHANGED
|
@@ -398,6 +398,7 @@ class Result:
|
|
|
398
398
|
>>> # Recompute with different arguments
|
|
399
399
|
>>> new_result = result.recompute(arguments=["--new-arg", "value"])
|
|
400
400
|
"""
|
|
401
|
+
self._refetch_job_dict()
|
|
401
402
|
app_response = BiolibAppApi.get_by_uri(uri=app_uri or self._job_dict['app_uri'])
|
|
402
403
|
|
|
403
404
|
job_storage_input = RemoteJobStorageEndpoint(
|
|
@@ -425,6 +426,7 @@ class Result:
|
|
|
425
426
|
app_uri=app_response['app_uri'],
|
|
426
427
|
app_version_uuid=app_response['app_version']['public_id'],
|
|
427
428
|
module_input_serialized=module_input_serialized,
|
|
429
|
+
override_command=self._job_dict['arguments_override_command'],
|
|
428
430
|
machine=machine if machine else original_requested_machine,
|
|
429
431
|
)
|
|
430
432
|
if blocking:
|
biolib/jobs/types.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
biolib/__init__.py,sha256
|
|
1
|
+
biolib/__init__.py,sha256=-pz1Ipyj1KmB709yYpl2Y-iKOWXpLxcFzL48G8rr9cU,12146
|
|
2
2
|
biolib/_data_record/data_record.py,sha256=BM2WEBnn13reSiAqhBtcV8FLewFWSTcMmFV0bD74bM0,12489
|
|
3
3
|
biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
biolib/_internal/add_copilot_prompts.py,sha256=wcIdrceFcfKSoEjvM4uNzhKZ0I1-MCFkfNO4duqtGHA,1861
|
|
@@ -60,6 +60,7 @@ biolib/_internal/types/result.py,sha256=MesSTBXCkaw8HydXgHf1OKGVLzsxhZ1KV5z4w-VI
|
|
|
60
60
|
biolib/_internal/types/typing.py,sha256=qrsk8hHcGEbDpU1QQFzHAKnhQxkMe7uJ6pxHeAnfv1Y,414
|
|
61
61
|
biolib/_internal/types/user.py,sha256=5_hYG0jrdGxynCCWXGaHZCAlVcRKBqMIEA2EBGrnpiE,439
|
|
62
62
|
biolib/_internal/utils/__init__.py,sha256=xp1I-lVnu5owV1CW53jiPEZLKmqqHiPUDfauYDfJ7iQ,1540
|
|
63
|
+
biolib/_internal/utils/job_url.py,sha256=YpwqCP56BD15M8p2tuSY_Z3O9vWAkG2rJbQu2Z5zqq0,1265
|
|
63
64
|
biolib/_internal/utils/multinode.py,sha256=N7kR49xD1PdkMVlxxzRiSYHfgi9MG-kLCwemcY1rojg,8323
|
|
64
65
|
biolib/_runtime/runtime.py,sha256=9q6Wuo8SBcJIezyScAgq2MDfpT0Pg8lcfbBFmeCWiUE,5974
|
|
65
66
|
biolib/_session/session.py,sha256=US1Y1jfFIAm86-Lq3C7nCXpZXUJXXBVBkND9djMNYxI,1649
|
|
@@ -141,9 +142,9 @@ biolib/compute_node/webserver/worker_thread.py,sha256=7uD9yQPhePYvP2HCJ27EeZ_h6p
|
|
|
141
142
|
biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
142
143
|
biolib/experiments/experiment.py,sha256=4g1xMYmfp5yzSOdwjf3pUUULF9QjqBJb4uQ25FHrFrk,13688
|
|
143
144
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
|
144
|
-
biolib/jobs/job.py,sha256=
|
|
145
|
+
biolib/jobs/job.py,sha256=aC3MfyNOC3z1HEK60OASjaS23Bwq0z6Wkjty56JFj7o,29065
|
|
145
146
|
biolib/jobs/job_result.py,sha256=_xqQu9z9BqPQrU6tjqKPuKlQDt5W0Zw5xiQvzEBkDyE,5266
|
|
146
|
-
biolib/jobs/types.py,sha256=
|
|
147
|
+
biolib/jobs/types.py,sha256=rFs6bQWsNI-nb1Hu9QzOW2zFZ8bOVt7ax4UpGVASxVA,1034
|
|
147
148
|
biolib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
148
149
|
biolib/runtime/__init__.py,sha256=MlRepA11n2H-3plB5rzWyyHK2JmP6PiaP3i6x3vt0mg,506
|
|
149
150
|
biolib/sdk/__init__.py,sha256=Z1S5BgpvM87S2o1libtqkYN1CfYUhn_d4ChEJjwdFKM,2356
|
|
@@ -157,8 +158,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
|
157
158
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
|
158
159
|
biolib/utils/seq_util.py,sha256=rImaghQGuIqTVWks6b9P2yKuN34uePUYPUFW_Wyoa4A,6737
|
|
159
160
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
|
160
|
-
pybiolib-1.2.
|
|
161
|
-
pybiolib-1.2.
|
|
162
|
-
pybiolib-1.2.
|
|
163
|
-
pybiolib-1.2.
|
|
164
|
-
pybiolib-1.2.
|
|
161
|
+
pybiolib-1.2.1295.dist-info/METADATA,sha256=URIKfpKORBz-C5Wvjq34LuMh7unEverSx9TMzQzMFhE,1644
|
|
162
|
+
pybiolib-1.2.1295.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
163
|
+
pybiolib-1.2.1295.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
|
164
|
+
pybiolib-1.2.1295.dist-info/licenses/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
|
165
|
+
pybiolib-1.2.1295.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|