Skip to content

Commit 62765b6

Browse files
GitHKAndrei Neagu
andauthored
🎨 Adds new progress bar to track starting software (#6353)
Co-authored-by: Andrei Neagu <[email protected]>
1 parent 8527559 commit 62765b6

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

packages/models-library/src/models_library/rabbitmq_messages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class ProgressType(StrAutoEnum):
8585
SERVICE_OUTPUTS_PULLING = auto()
8686
SERVICE_STATE_PULLING = auto()
8787
SERVICE_IMAGES_PULLING = auto()
88+
SERVICE_CONTAINERS_STARTING = auto()
8889

8990
SERVICE_STATE_PUSHING = auto()
9091
SERVICE_OUTPUTS_PUSHING = auto()

packages/service-library/src/servicelib/docker_utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,19 @@ async def _parse_pull_information(
176176
layer_id_to_size.setdefault(
177177
parsed_progress.id, _PulledStatus(0)
178178
).extracted = layer_id_to_size[parsed_progress.id].size
179+
case "already exists":
180+
assert parsed_progress.id # nosec
181+
layer_id_to_size.setdefault(
182+
parsed_progress.id, _PulledStatus(0)
183+
).extracted = layer_id_to_size[parsed_progress.id].size
184+
layer_id_to_size.setdefault(
185+
parsed_progress.id, _PulledStatus(0)
186+
).downloaded = layer_id_to_size[parsed_progress.id].size
179187
case progress_status if any(
180188
msg in progress_status
181189
for msg in [
182190
"status: downloaded newer image for ",
183191
"status: image is up to date for ",
184-
"already exists",
185192
]
186193
):
187194
for layer_pull_status in layer_id_to_size.values():

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/long_running_tasks.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,27 @@ async def task_create_service_containers(
168168

169169
assert shared_store.compose_spec # nosec
170170

171-
async with event_propagation_disabled(app), _reset_on_error(shared_store):
171+
async with event_propagation_disabled(app), _reset_on_error(
172+
shared_store
173+
), ProgressBarData(
174+
num_steps=4,
175+
progress_report_cb=functools.partial(
176+
post_progress_message,
177+
app,
178+
ProgressType.SERVICE_CONTAINERS_STARTING,
179+
),
180+
description=IDStr("starting software"),
181+
) as progress_bar:
172182
with log_context(_logger, logging.INFO, "load user services preferences"):
173183
if user_services_preferences.is_feature_enabled(app):
174184
await user_services_preferences.load_user_services_preferences(app)
185+
await progress_bar.update()
175186

176187
# removes previous pending containers
177188
progress.update(message="cleanup previous used resources")
178189
result = await docker_compose_rm(shared_store.compose_spec, settings)
179190
_raise_for_errors(result, "rm")
180-
181-
progress.update(message="pulling images", percent=ProgressPercent(0.01))
182-
await post_sidecar_log_message(
183-
app, "pulling service images", log_level=logging.INFO
184-
)
185-
await docker_compose_pull(app, shared_store.compose_spec)
186-
await post_sidecar_log_message(
187-
app, "service images ready", log_level=logging.INFO
188-
)
191+
await progress_bar.update()
189192

190193
progress.update(
191194
message="creating and starting containers", percent=ProgressPercent(0.90)
@@ -194,6 +197,7 @@ async def task_create_service_containers(
194197
app, "starting service containers", log_level=logging.INFO
195198
)
196199
await _retry_docker_compose_create(shared_store.compose_spec, settings)
200+
await progress_bar.update()
197201

198202
progress.update(
199203
message="ensure containers are started", percent=ProgressPercent(0.95)

services/static-webserver/client/source/class/osparc/data/model/NodeProgressSequence.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
9696
apply: "__applyImagesPulling"
9797
},
9898

99+
startingSoftware: {
100+
check: "Object",
101+
init: {
102+
progressLabel: qx.locale.Manager.tr("Waiting ..."),
103+
value: 0
104+
},
105+
nullable: false,
106+
apply: "__applyStartingSoftware"
107+
},
108+
99109
inputsPulling: {
100110
check: "Object",
101111
init: {
@@ -135,6 +145,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
135145
__pullingOutputsLayout: null,
136146
__pullingStateLayout: null,
137147
__pullingImagesLayout: null,
148+
__startingSoftwareLayout: null,
138149
__pullingInputsLayout: null,
139150
__disclaimerTimer: null,
140151
__disclaimerText: null,
@@ -168,6 +179,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
168179
this.setOutputsPulling(defaultVals);
169180
this.setStatePulling(defaultVals);
170181
this.setImagesPulling(defaultVals);
182+
this.setStartingSoftware(defaultVals);
171183
this.setInputsPulling(defaultVals);
172184
},
173185

@@ -203,6 +215,9 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
203215
case "SERVICE_IMAGES_PULLING":
204216
this.setImagesPulling(progress);
205217
break;
218+
case "SERVICE_CONTAINERS_STARTING":
219+
this.setStartingSoftware(progress);
220+
break;
206221
case "SERVICE_INPUTS_PULLING":
207222
this.setInputsPulling(progress);
208223
break;
@@ -213,13 +228,14 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
213228
this.__mainLoadingPage = new qx.ui.container.Composite(new qx.ui.layout.VBox(8));
214229

215230
const sequenceLoadingPage = new osparc.widget.ProgressSequence(qx.locale.Manager.tr("LOADING ..."));
216-
const nTasks = 6;
231+
const nTasks = 7;
217232
this.__overallProgressBar = sequenceLoadingPage.addOverallProgressBar(nTasks);
218233
this.__clusterUpScalingLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Increasing system capacity ..."));
219234
this.__pullingSidecarLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Setting up key components ..."));
220235
this.__pullingOutputsLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Retrieving your output data ..."));
221236
this.__pullingStateLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Retrieving your work ..."));
222237
this.__pullingImagesLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Installing software ..."));
238+
this.__startingSoftwareLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Starting software ..."));
223239
this.__pullingInputsLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Retrieving your input data ..."));
224240
this.__mainLoadingPage.addAt(sequenceLoadingPage, 0, {
225241
flex: 1
@@ -298,6 +314,16 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
298314
this.__computeOverallProgress();
299315
},
300316

317+
__applyStartingSoftware: function(value) {
318+
if (value.value > 0) {
319+
const defaultEndVals = this.getDefaultEndValues();
320+
this.setSidecarPulling(defaultEndVals);
321+
}
322+
osparc.widget.ProgressSequence.updateTaskProgress(this.__startingSoftwareLayout, value);
323+
324+
this.__computeOverallProgress();
325+
},
326+
301327
__applyInputsPulling: function(value) {
302328
if (value.value > 0) {
303329
const defaultEndVals = this.getDefaultEndValues();

0 commit comments

Comments
 (0)