pybiolib 1.1.1971__py3-none-any.whl → 1.1.1974__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/jobs/job.py +9 -10
- biolib/jobs/job_result.py +13 -14
- biolib/jobs/types.py +1 -1
- {pybiolib-1.1.1971.dist-info → pybiolib-1.1.1974.dist-info}/METADATA +1 -1
- {pybiolib-1.1.1971.dist-info → pybiolib-1.1.1974.dist-info}/RECORD +8 -8
- {pybiolib-1.1.1971.dist-info → pybiolib-1.1.1974.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.1971.dist-info → pybiolib-1.1.1974.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.1971.dist-info → pybiolib-1.1.1974.dist-info}/entry_points.txt +0 -0
biolib/jobs/job.py
CHANGED
@@ -56,7 +56,7 @@ class Job:
|
|
56
56
|
@property
|
57
57
|
def result(self) -> JobResult:
|
58
58
|
if not self._result:
|
59
|
-
if self.get_status() ==
|
59
|
+
if self.get_status() == 'completed':
|
60
60
|
self._result = JobResult(job_uuid=self._uuid, job_auth_token=self._auth_token)
|
61
61
|
else:
|
62
62
|
raise BioLibError(f"Result is not available for {self._uuid}: status is {self._job_dict['state']}.")
|
@@ -65,17 +65,17 @@ class Job:
|
|
65
65
|
|
66
66
|
@property
|
67
67
|
def stdout(self) -> bytes:
|
68
|
-
logger.warning(
|
68
|
+
logger.warning('The property .stdout is deprecated, please use .get_stdout()')
|
69
69
|
return self.result.get_stdout()
|
70
70
|
|
71
71
|
@property
|
72
72
|
def stderr(self) -> bytes:
|
73
|
-
logger.warning(
|
73
|
+
logger.warning('The property .stderr is deprecated, please use .get_stderr()')
|
74
74
|
return self.result.get_stderr()
|
75
75
|
|
76
76
|
@property
|
77
77
|
def exitcode(self) -> int:
|
78
|
-
logger.warning(
|
78
|
+
logger.warning('The property .exitcode is deprecated, please use .get_exit_code()')
|
79
79
|
return self.result.get_exit_code()
|
80
80
|
|
81
81
|
def is_finished(self) -> bool:
|
@@ -109,8 +109,8 @@ class Job:
|
|
109
109
|
def load_file_as_numpy(self, *args, **kwargs):
|
110
110
|
try:
|
111
111
|
import numpy # type: ignore # pylint: disable=import-outside-toplevel,import-error
|
112
|
-
except: # pylint: disable=raise-missing-from
|
113
|
-
raise Exception(
|
112
|
+
except ImportError: # pylint: disable=raise-missing-from
|
113
|
+
raise Exception('Failed to import numpy, please make sure it is installed.') from None
|
114
114
|
file_handle = self.result.get_output_file(*args, **kwargs).get_file_handle()
|
115
115
|
return numpy.load(file_handle, allow_pickle=False) # type: ignore
|
116
116
|
|
@@ -198,7 +198,6 @@ class Job:
|
|
198
198
|
except Exception as error:
|
199
199
|
logger.error(f'Failed to cancel job {self._uuid} due to: {error}')
|
200
200
|
|
201
|
-
|
202
201
|
def _get_cloud_job(self) -> CloudJobDict:
|
203
202
|
self._refetch_job_dict(force_refetch=True)
|
204
203
|
if self._job_dict['cloud_job'] is None:
|
@@ -290,7 +289,7 @@ class Job:
|
|
290
289
|
status_json = self._get_job_status_from_compute_node(compute_node_url)
|
291
290
|
if not status_json:
|
292
291
|
# this can happen if the job is finished but already removed from the compute node
|
293
|
-
logger.warning(
|
292
|
+
logger.warning('WARN: We were unable to retrieve the full log of the job, please try again')
|
294
293
|
break
|
295
294
|
job_is_completed = status_json['is_completed']
|
296
295
|
for status_update in status_json['status_updates']:
|
@@ -353,9 +352,9 @@ class Job:
|
|
353
352
|
return HttpClient.request(url=f'{compute_node_url}/v1/job/{self._uuid}/status/').json()
|
354
353
|
except Exception: # pylint: disable=broad-except
|
355
354
|
cloud_job = self._get_cloud_job()
|
356
|
-
logger.debug(
|
355
|
+
logger.debug('Failed to get status from compute node, retrying...')
|
357
356
|
if cloud_job['finished_at']:
|
358
|
-
logger.debug(
|
357
|
+
logger.debug('Job no longer exists on compute node, checking for error...')
|
359
358
|
if cloud_job['error_code'] != SystemExceptionCodes.COMPLETED_SUCCESSFULLY.value:
|
360
359
|
error_message = SystemExceptionCodeMap.get(
|
361
360
|
cloud_job['error_code'], f'Unknown error code {cloud_job["error_code"]}'
|
biolib/jobs/job_result.py
CHANGED
@@ -1,25 +1,24 @@
|
|
1
|
-
from pathlib import Path
|
2
|
-
from fnmatch import fnmatch
|
3
1
|
import time
|
2
|
+
from fnmatch import fnmatch
|
3
|
+
from pathlib import Path
|
4
4
|
|
5
5
|
from biolib.biolib_binary_format import ModuleOutputV2
|
6
|
-
from biolib.biolib_binary_format.remote_stream_seeker import StreamSeeker
|
7
|
-
from biolib.biolib_binary_format.utils import RemoteIndexableBuffer, LazyLoadedFile
|
8
6
|
from biolib.biolib_binary_format.remote_endpoints import RemoteJobStorageResultEndpoint
|
7
|
+
from biolib.biolib_binary_format.remote_stream_seeker import StreamSeeker
|
8
|
+
from biolib.biolib_binary_format.utils import LazyLoadedFile, RemoteIndexableBuffer
|
9
9
|
from biolib.biolib_errors import BioLibError
|
10
10
|
from biolib.biolib_logging import logger
|
11
|
-
from biolib.typing_utils import
|
11
|
+
from biolib.typing_utils import Callable, List, Optional, Union, cast
|
12
12
|
|
13
13
|
PathFilter = Union[str, Callable[[str], bool]]
|
14
14
|
|
15
15
|
|
16
16
|
class JobResult:
|
17
|
-
|
18
17
|
def __init__(
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
self,
|
19
|
+
job_uuid: str,
|
20
|
+
job_auth_token: str,
|
21
|
+
module_output: Optional[ModuleOutputV2] = None,
|
23
22
|
):
|
24
23
|
self._job_uuid: str = job_uuid
|
25
24
|
self._job_auth_token: str = job_auth_token
|
@@ -75,10 +74,10 @@ class JobResult:
|
|
75
74
|
files = self._get_module_output().get_files()
|
76
75
|
filtered_files = self._get_filtered_files(files, path_filter=filename)
|
77
76
|
if not filtered_files:
|
78
|
-
raise BioLibError(f
|
77
|
+
raise BioLibError(f'File {filename} not found in results.')
|
79
78
|
|
80
79
|
if len(filtered_files) != 1:
|
81
|
-
raise BioLibError(f
|
80
|
+
raise BioLibError(f'Found multiple results for filename {filename}.')
|
82
81
|
|
83
82
|
return filtered_files[0]
|
84
83
|
|
@@ -100,8 +99,8 @@ class JobResult:
|
|
100
99
|
glob_filter = cast(str, path_filter)
|
101
100
|
|
102
101
|
# since all file paths start with /, make sure filter does too
|
103
|
-
if not glob_filter.startswith(
|
104
|
-
glob_filter =
|
102
|
+
if not glob_filter.startswith('/'):
|
103
|
+
glob_filter = '/' + glob_filter
|
105
104
|
|
106
105
|
def _filter_function(file: LazyLoadedFile) -> bool:
|
107
106
|
return fnmatch(file.path, glob_filter)
|
biolib/jobs/types.py
CHANGED
@@ -89,9 +89,9 @@ biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
89
89
|
biolib/experiments/experiment.py,sha256=kUQsH9AGAckPKT_nzaRuTh8Mb2pVUpxnuX9IstRTOEo,6351
|
90
90
|
biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
|
91
91
|
biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
|
92
|
-
biolib/jobs/job.py,sha256
|
93
|
-
biolib/jobs/job_result.py,sha256=
|
94
|
-
biolib/jobs/types.py,sha256=
|
92
|
+
biolib/jobs/job.py,sha256=-H83m5BJs0l9Pe_lsExlcqH5gAHOVREeQBZs6umWdYc,16178
|
93
|
+
biolib/jobs/job_result.py,sha256=bJm0q7L_11ekOJBiC6jIaeYo_zxDJKSB0TGsLI30BBo,4896
|
94
|
+
biolib/jobs/types.py,sha256=qhadtH2KDC2WUOOqPiwke0YgtQY4FtuB71Stekq1k48,970
|
95
95
|
biolib/lfs/__init__.py,sha256=Qv8vdYeK43JecT4SsE93ZYE2VmNiZENdNpW8P9-omxs,115
|
96
96
|
biolib/lfs/cache.py,sha256=pQS2np21rdJ6I3DpoOutnzPHpLOZgUIS8TMltUJk_k4,2226
|
97
97
|
biolib/lfs/utils.py,sha256=HSs7F2wXklYhhv5tabfaeC5noXJyxRjbGD5IhWOVdxs,5918
|
@@ -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.1974.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.1974.dist-info/METADATA,sha256=pTLqiAvKtqfjL4SzRbwKtNUCKdpePX8CJzlm2S4naFI,1508
|
114
|
+
pybiolib-1.1.1974.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.1974.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.1974.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|