lablup / backend.ai

Backend.AI is a streamlined, container-based computing cluster platform that hosts popular computing/ML frameworks and diverse programming languages, with pluggable heterogeneous accelerator support including CUDA GPU, ROCm GPU, TPU, IPU and other NPUs.
https://www.backend.ai
GNU Lesser General Public License v3.0
504 stars 150 forks source link

fix: Installer regression after upgrading Textual #2867

Closed achimnol closed 4 days ago

achimnol commented 4 days ago

This is a follow-up fix to #2851.

We began to observe the following error when starting package downloads in the TUI installer:

ExceptionGroup('unhandled errors in a TaskGroup', [
  MountError("Can't mount widget(s) before Static() is mounted"),
  MountError("Can't mount widget(s) before Static() is mounted"),
  ...,
])

Mounting widgets in arbitrary orders is deliberately forbidden since Textual 0.63.3 (Textualize/textual#4547), and we've upgraded it from 0.59.4 to 0.79.1.

This PR updates the progress bar item insertion routines to use an explicit compound widget ProgressItem instead of manually mounting widgets inside.

[!NOTE] We have to await the mount() methods to ensure that we can actually query and access the inner widget instances.

An alternative fix is:

         item = Static(classes="progress-item")
         label = Label(Text.from_markup(f"[blue](download)[/] {pkg_name}"), classes="progress-name")
         progress = ProgressBar(classes="progress-download")
-        item.mount_all([label, progress])
-        vpane.mount(item)
+        await vpane.mount(item)
+        await item.mount_all([label, progress])

but I think extracting those verbose, duplicate lines as a separate compound widget is a better fix.

Checklist: (if applicable)