Skip to content

Commit 24de395

Browse files
committed
Show docker layer output
1 parent 63119d5 commit 24de395

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

llmstack/cli.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import secrets
44
import subprocess
55
import sys
6+
from collections import defaultdict
67

78
import docker
89
import toml
@@ -104,10 +105,28 @@ def start_runner(environment):
104105
image_tag = environment.get('RUNNER_IMAGE_TAG', 'main')
105106

106107
# Pull image if not already pulled
107-
for line in client.api.pull(image_name, tag=image_tag, stream=True, decode=True):
108-
if 'progress' in line and 'id' in line:
109-
print(
110-
f'[llmstack-runner] Pulling {line["id"][:12]} {line["progress"]}', end='\r')
108+
layers_status = defaultdict(dict)
109+
response = client.api.pull(
110+
image_name, tag=image_tag, stream=True, decode=True)
111+
for line in response:
112+
if 'id' in line:
113+
layer_id = line['id']
114+
# Update the status of this layer
115+
layers_status[layer_id].update(line)
116+
117+
# Print the current status of all layers
118+
for layer, status in layers_status.items():
119+
print(
120+
f"[llmstack-runner] Layer {layer}: {status.get('status', '')} {status.get('progress', '')}")
121+
print() # Add a blank line for better readability
122+
123+
elif 'status' in line and 'id' not in line:
124+
# Global status messages without a specific layer ID
125+
print(line['status'])
126+
127+
elif 'error' in line:
128+
print(f"Error: {line['error']}")
129+
break
111130

112131
try:
113132
runner_container = client.containers.get('llmstack-runner')

0 commit comments

Comments
 (0)