pybiolib 1.2.582__py3-none-any.whl → 1.2.600__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.
@@ -17,6 +17,7 @@ from biolib.biolib_docker_client import BiolibDockerClient
17
17
  from biolib.biolib_errors import BioLibError
18
18
  from biolib.biolib_logging import logger
19
19
  from biolib.typing_utils import Iterable, Optional, Set, TypedDict
20
+ from biolib.utils.app_uri import parse_app_uri
20
21
 
21
22
  REGEX_MARKDOWN_INLINE_IMAGE = re.compile(r'!\[(?P<alt>.*)\]\((?P<src>.*)\)')
22
23
 
@@ -79,22 +80,24 @@ def push_application(
79
80
  set_as_active: bool,
80
81
  set_as_published: bool,
81
82
  ):
82
- app_uri_parts = app_uri.split(':')
83
- if len(app_uri_parts) > 2:
84
- raise BioLibError('Invalid URI only a single colon allowed')
83
+ parsed_uri = parse_app_uri(app_uri)
84
+ app_name = parsed_uri['app_name']
85
85
 
86
- app_uri_to_fetch = app_uri_parts[0]
87
- semantic_version = app_uri_parts[1] if len(app_uri_parts) == 2 else None
86
+ app_uri_to_fetch = f"@{parsed_uri['resource_name_prefix']}/{parsed_uri['account_handle_normalized']}/{app_name}"
87
+
88
+ version = parsed_uri['version']
89
+ semantic_version = f"{version['major']}.{version['minor']}.{version['patch']}" if version else None
88
90
 
89
91
  app_path_absolute = Path(app_path).resolve()
90
92
 
91
93
  api_client = BiolibApiClient.get()
92
94
  if not api_client.is_signed_in:
93
95
  # TODO: Create an exception class for expected errors like this that does not print stacktrace
96
+
94
97
  raise Exception(
95
98
  'You must be authenticated to push an application.\n'
96
- 'Please set the environment variable "BIOLIB_TOKEN=[your_api_token]"\n'
97
- f'You can get an API token at: {api_client.base_url}/settings/api-tokens/'
99
+ 'Please set the environment variable "BIOLIB_TOKEN=[your_deploy_token]"\n'
100
+ f'You can get a deploy key at: {api_client.base_url}/{app_uri_to_fetch}/settings/keys'
98
101
  ) from None
99
102
 
100
103
  # prepare zip file
biolib/jobs/job.py CHANGED
@@ -91,6 +91,24 @@ class Job:
91
91
  self._refetch_job_dict()
92
92
  return bool(self._job_dict['ended_at'])
93
93
 
94
+ def is_pending(self) -> bool:
95
+ """Returns whether the job is in a pending state.
96
+
97
+ A job is considered pending if it's not finished yet.
98
+ The job state is re-fetched when this method is called.
99
+
100
+ Returns:
101
+ bool: True if the job is in a pending state, False otherwise.
102
+
103
+ Example::
104
+ >>> job = biolib.get_job("job_id")
105
+ >>> if job.is_pending():
106
+ >>> print("Job is still running")
107
+ >>> else:
108
+ >>> print("Job has finished")
109
+ """
110
+ return not self.is_finished()
111
+
94
112
  def get_name(self) -> str:
95
113
  self._refetch_job_dict()
96
114
  return self._job_dict['main_result']['name']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pybiolib
3
- Version: 1.2.582
3
+ Version: 1.2.600
4
4
  Summary: BioLib Python Client
5
5
  License: MIT
6
6
  Keywords: biolib
@@ -13,7 +13,7 @@ biolib/_internal/lfs/__init__.py,sha256=gSWo_xg61UniYgD7yNYxeT4I9uaXBCBSi3_nmZjn
13
13
  biolib/_internal/lfs/cache.py,sha256=pQS2np21rdJ6I3DpoOutnzPHpLOZgUIS8TMltUJk_k4,2226
14
14
  biolib/_internal/libs/__init__.py,sha256=Jdf4tNPqe_oIIf6zYml6TiqhL_02Vyqwge6IELrAFhw,98
15
15
  biolib/_internal/libs/fusepy/__init__.py,sha256=AWDzNFS-XV_5yKb0Qx7kggIhPzq1nj_BZS5y2Nso08k,41944
16
- biolib/_internal/push_application.py,sha256=C5YXh-TZzVnz5eBPOWWOU6n750JyKVdHvIQQc-wddG4,12152
16
+ biolib/_internal/push_application.py,sha256=RkS3lFx_T4zhIuLq3yoe_oolSNvDUPC-Xx1Rz7GJkaE,12295
17
17
  biolib/_internal/runtime.py,sha256=BiHl4klUHr36MCpqKaUso4idHeBZfPAahLYRQrabFqA,486
18
18
  biolib/_internal/types/__init__.py,sha256=xLgOQJFh3GRtiqIJq7MaqHReZx4pp34_zcaFQ_JjuJ4,198
19
19
  biolib/_internal/types/app.py,sha256=Mz2QGD_jESX-K9JYnLWPo4YA__Q_1FQQTk9pvidCohU,118
@@ -102,7 +102,7 @@ biolib/compute_node/webserver/worker_thread.py,sha256=7uD9yQPhePYvP2HCJ27EeZ_h6p
102
102
  biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
103
  biolib/experiments/experiment.py,sha256=pBtnOHz0kKoFxlIGf08o8ZCEOze-CljwfOsTdhvCTCk,8646
104
104
  biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
105
- biolib/jobs/job.py,sha256=v6q7QbQWKeNCl5Sog912aduboq7PU1l4vhOVhlZewEI,23591
105
+ biolib/jobs/job.py,sha256=rcQPLrUsVHdzZ0g_T9f3m_mmVF0m-aYi_fKYTbQATaA,24174
106
106
  biolib/jobs/job_result.py,sha256=rALHiKYNaC9lHi_JJqBob1RubzNLwG9Z386kwRJjd2M,5885
107
107
  biolib/jobs/types.py,sha256=ezvaoTANsWazK6PmfpYcqezdfjP7MNBEBfqIZGoZhz8,997
108
108
  biolib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -120,8 +120,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
120
120
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
121
121
  biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
122
122
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
123
- pybiolib-1.2.582.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
124
- pybiolib-1.2.582.dist-info/METADATA,sha256=EXVefv4YrS8ZoOBerWf0yDWbEHE_LIGzj5QLbzeZ2SY,1570
125
- pybiolib-1.2.582.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
126
- pybiolib-1.2.582.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
127
- pybiolib-1.2.582.dist-info/RECORD,,
123
+ pybiolib-1.2.600.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
124
+ pybiolib-1.2.600.dist-info/METADATA,sha256=26dUH21EFM2Qk4OkexGvTh8LHhOTnJ442I4RcgS_sIE,1570
125
+ pybiolib-1.2.600.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
126
+ pybiolib-1.2.600.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
127
+ pybiolib-1.2.600.dist-info/RECORD,,