pybiolib 1.2.876__py3-none-any.whl → 1.2.878__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.
@@ -1,5 +1,7 @@
1
1
  import os
2
2
  import re
3
+ import sys
4
+ import time
3
5
  from pathlib import Path
4
6
 
5
7
  import rich.progress
@@ -36,6 +38,13 @@ class DockerStatusUpdate(TypedDict, total=False):
36
38
 
37
39
 
38
40
  def process_docker_status_updates(status_updates: Iterable[DockerStatusUpdate], action: str) -> None:
41
+ if sys.stdout.isatty():
42
+ _process_docker_status_updates_with_progress_bar(status_updates, action)
43
+ else:
44
+ _process_docker_status_updates_with_logging(status_updates, action)
45
+
46
+
47
+ def _process_docker_status_updates_with_progress_bar(status_updates: Iterable[DockerStatusUpdate], action: str) -> None:
39
48
  with rich.progress.Progress() as progress:
40
49
  layer_id_to_task_id = {}
41
50
  overall_task_id = progress.add_task(description=f'[bold blue]{action} Docker image', total=None)
@@ -97,6 +106,74 @@ def process_docker_status_updates(status_updates: Iterable[DockerStatusUpdate],
97
106
  print(update)
98
107
 
99
108
 
109
+ def _process_docker_status_updates_with_logging(status_updates: Iterable[DockerStatusUpdate], action: str) -> None:
110
+ layer_progress = {}
111
+ layer_status = {}
112
+ last_log_time = time.time()
113
+
114
+ logger.info(f'{action} Docker image...')
115
+
116
+ for update in status_updates:
117
+ current_time = time.time()
118
+
119
+ if 'progressDetail' in update and 'id' in update:
120
+ layer_id = update['id']
121
+ progress_detail = update['progressDetail']
122
+
123
+ if progress_detail and 'current' in progress_detail and 'total' in progress_detail:
124
+ current = progress_detail['current']
125
+ total = progress_detail['total']
126
+ percentage = (current / total * 100) if total > 0 else 0
127
+ layer_progress[layer_id] = percentage
128
+ layer_status[layer_id] = f'{action.lower()}'
129
+ elif update.get('status') == 'Layer already exists':
130
+ layer_progress[layer_id] = 100
131
+ layer_status[layer_id] = 'already exists'
132
+
133
+ elif 'status' in update and 'id' in update:
134
+ layer_id = update['id']
135
+ status = update['status']
136
+ layer_status[layer_id] = status.lower()
137
+
138
+ if status in ['Pushed', 'Uploaded'] or status == 'Layer already exists':
139
+ layer_progress[layer_id] = 100
140
+
141
+ elif 'status' in update and update['status']:
142
+ status = update['status']
143
+ if status not in ['Preparing', 'Pushing', 'Pushed', 'Waiting', 'Layer already exists']:
144
+ logger.info(f'{action} Docker image - {status}')
145
+
146
+ if current_time - last_log_time >= 10.0:
147
+ _log_progress_summary(action, layer_progress, layer_status)
148
+ last_log_time = current_time
149
+
150
+ _log_progress_summary(action, layer_progress, layer_status)
151
+ logger.info(f'{action} Docker image completed')
152
+
153
+
154
+ def _log_progress_summary(action: str, layer_progress: dict, layer_status: dict) -> None:
155
+ if not layer_progress and not layer_status:
156
+ return
157
+
158
+ completed_layers = sum(1 for progress in layer_progress.values() if progress >= 100)
159
+ total_layers = len(layer_progress) if layer_progress else len(layer_status)
160
+
161
+ if total_layers > 0:
162
+ overall_percentage = completed_layers / total_layers * 100
163
+ logger.info(
164
+ f'{action} progress: {completed_layers}/{total_layers} layers completed ({overall_percentage:.1f}%)'
165
+ )
166
+
167
+ active_layers = [
168
+ layer_id
169
+ for layer_id, status in layer_status.items()
170
+ if status in ['preparing', 'waiting', 'pushing', 'uploading'] and layer_progress.get(layer_id, 0) < 100
171
+ ]
172
+
173
+ if active_layers:
174
+ logger.info(f'Active layers: {", ".join(active_layers[:5])}{"..." if len(active_layers) > 5 else ""}')
175
+
176
+
100
177
  def set_app_version_as_active(
101
178
  app_version_uuid: str,
102
179
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pybiolib
3
- Version: 1.2.876
3
+ Version: 1.2.878
4
4
  Summary: BioLib Python Client
5
5
  License: MIT
6
6
  Keywords: biolib
@@ -21,7 +21,7 @@ biolib/_internal/llm_instructions/.github/instructions/style-react-ts.instructio
21
21
  biolib/_internal/llm_instructions/.github/prompts/biolib_app_inputs.prompt.md,sha256=SMzXZImdID0yKjhE1fG54VrHdD8IVuwRxRKsMF-KjWs,697
22
22
  biolib/_internal/llm_instructions/.github/prompts/biolib_run_apps.prompt.md,sha256=-t1bmGr3zEFa6lKHaLcI98yq4Sg1TCMW8xbelNSHaOA,696
23
23
  biolib/_internal/llm_instructions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- biolib/_internal/push_application.py,sha256=snnd3aCPJeByEQTCajDi7Op5TH9-BXjJS9QCS8e6cjY,14347
24
+ biolib/_internal/push_application.py,sha256=nyZ8vd4nMAqySYRBDfzCa1vAB1S2DU7sOt7H22Ph1Ss,17464
25
25
  biolib/_internal/runtime.py,sha256=BiHl4klUHr36MCpqKaUso4idHeBZfPAahLYRQrabFqA,486
26
26
  biolib/_internal/templates/__init__.py,sha256=NVbhLUMC8HITzkLvP88Qu7FHaL-SvQord-DX3gh1Ykk,24
27
27
  biolib/_internal/templates/init_template/.biolib/config.yml,sha256=y4ndTgbFvUE1UiGcIOqogT2Wm8jahGffeyU5rlCEltQ,427
@@ -140,8 +140,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
140
140
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
141
141
  biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
142
142
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
143
- pybiolib-1.2.876.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
144
- pybiolib-1.2.876.dist-info/METADATA,sha256=Vcom4VROgeB12DAZP7lZnWrX7hZ0wipD3drOcAn8RGs,1570
145
- pybiolib-1.2.876.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
146
- pybiolib-1.2.876.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
147
- pybiolib-1.2.876.dist-info/RECORD,,
143
+ pybiolib-1.2.878.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
144
+ pybiolib-1.2.878.dist-info/METADATA,sha256=KbuzZ2QK3MdPKoTdKfS_BzHc-jp-OBMB2fty1BKNadg,1570
145
+ pybiolib-1.2.878.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
146
+ pybiolib-1.2.878.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
147
+ pybiolib-1.2.878.dist-info/RECORD,,