Skip to content

Commit

Permalink
🎨 Adds new progress bar to track starting software (#6353)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Neagu <[email protected]>
  • Loading branch information
GitHK and Andrei Neagu authored Sep 13, 2024
1 parent 8527559 commit 62765b6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ProgressType(StrAutoEnum):
SERVICE_OUTPUTS_PULLING = auto()
SERVICE_STATE_PULLING = auto()
SERVICE_IMAGES_PULLING = auto()
SERVICE_CONTAINERS_STARTING = auto()

SERVICE_STATE_PUSHING = auto()
SERVICE_OUTPUTS_PUSHING = auto()
Expand Down
9 changes: 8 additions & 1 deletion packages/service-library/src/servicelib/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,19 @@ async def _parse_pull_information(
layer_id_to_size.setdefault(
parsed_progress.id, _PulledStatus(0)
).extracted = layer_id_to_size[parsed_progress.id].size
case "already exists":
assert parsed_progress.id # nosec
layer_id_to_size.setdefault(
parsed_progress.id, _PulledStatus(0)
).extracted = layer_id_to_size[parsed_progress.id].size
layer_id_to_size.setdefault(
parsed_progress.id, _PulledStatus(0)
).downloaded = layer_id_to_size[parsed_progress.id].size
case progress_status if any(
msg in progress_status
for msg in [
"status: downloaded newer image for ",
"status: image is up to date for ",
"already exists",
]
):
for layer_pull_status in layer_id_to_size.values():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,27 @@ async def task_create_service_containers(

assert shared_store.compose_spec # nosec

async with event_propagation_disabled(app), _reset_on_error(shared_store):
async with event_propagation_disabled(app), _reset_on_error(
shared_store
), ProgressBarData(
num_steps=4,
progress_report_cb=functools.partial(
post_progress_message,
app,
ProgressType.SERVICE_CONTAINERS_STARTING,
),
description=IDStr("starting software"),
) as progress_bar:
with log_context(_logger, logging.INFO, "load user services preferences"):
if user_services_preferences.is_feature_enabled(app):
await user_services_preferences.load_user_services_preferences(app)
await progress_bar.update()

# removes previous pending containers
progress.update(message="cleanup previous used resources")
result = await docker_compose_rm(shared_store.compose_spec, settings)
_raise_for_errors(result, "rm")

progress.update(message="pulling images", percent=ProgressPercent(0.01))
await post_sidecar_log_message(
app, "pulling service images", log_level=logging.INFO
)
await docker_compose_pull(app, shared_store.compose_spec)
await post_sidecar_log_message(
app, "service images ready", log_level=logging.INFO
)
await progress_bar.update()

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

progress.update(
message="ensure containers are started", percent=ProgressPercent(0.95)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
apply: "__applyImagesPulling"
},

startingSoftware: {
check: "Object",
init: {
progressLabel: qx.locale.Manager.tr("Waiting ..."),
value: 0
},
nullable: false,
apply: "__applyStartingSoftware"
},

inputsPulling: {
check: "Object",
init: {
Expand Down Expand Up @@ -135,6 +145,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
__pullingOutputsLayout: null,
__pullingStateLayout: null,
__pullingImagesLayout: null,
__startingSoftwareLayout: null,
__pullingInputsLayout: null,
__disclaimerTimer: null,
__disclaimerText: null,
Expand Down Expand Up @@ -168,6 +179,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
this.setOutputsPulling(defaultVals);
this.setStatePulling(defaultVals);
this.setImagesPulling(defaultVals);
this.setStartingSoftware(defaultVals);
this.setInputsPulling(defaultVals);
},

Expand Down Expand Up @@ -203,6 +215,9 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
case "SERVICE_IMAGES_PULLING":
this.setImagesPulling(progress);
break;
case "SERVICE_CONTAINERS_STARTING":
this.setStartingSoftware(progress);
break;
case "SERVICE_INPUTS_PULLING":
this.setInputsPulling(progress);
break;
Expand All @@ -213,13 +228,14 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
this.__mainLoadingPage = new qx.ui.container.Composite(new qx.ui.layout.VBox(8));

const sequenceLoadingPage = new osparc.widget.ProgressSequence(qx.locale.Manager.tr("LOADING ..."));
const nTasks = 6;
const nTasks = 7;
this.__overallProgressBar = sequenceLoadingPage.addOverallProgressBar(nTasks);
this.__clusterUpScalingLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Increasing system capacity ..."));
this.__pullingSidecarLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Setting up key components ..."));
this.__pullingOutputsLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Retrieving your output data ..."));
this.__pullingStateLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Retrieving your work ..."));
this.__pullingImagesLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Installing software ..."));
this.__startingSoftwareLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Starting software ..."));
this.__pullingInputsLayout = sequenceLoadingPage.addNewTask(qx.locale.Manager.tr("Retrieving your input data ..."));
this.__mainLoadingPage.addAt(sequenceLoadingPage, 0, {
flex: 1
Expand Down Expand Up @@ -298,6 +314,16 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
this.__computeOverallProgress();
},

__applyStartingSoftware: function(value) {
if (value.value > 0) {
const defaultEndVals = this.getDefaultEndValues();
this.setSidecarPulling(defaultEndVals);
}
osparc.widget.ProgressSequence.updateTaskProgress(this.__startingSoftwareLayout, value);

this.__computeOverallProgress();
},

__applyInputsPulling: function(value) {
if (value.value > 0) {
const defaultEndVals = this.getDefaultEndValues();
Expand Down

0 comments on commit 62765b6

Please sign in to comment.