meltano icon indicating copy to clipboard operation
meltano copied to clipboard

feature: Long running commands should include a spinner animation

Open BraedonLeonard opened this issue 2 years ago • 8 comments

Feature scope

CLI (options, error messages, logging, etc.)

Description

When I was working through the Getting Started guide, I got to the step where you install the airflow orchestrator. After running meltano add orchestrator airflow, the command will reach a point where it sits for multiple minutes with absolutely no feedback to the user. When this happens, it can be very hard to tell whether or not the program has frozen or not, so it would be reassuring to have a spinner animation of some kind for these commands to show that things are still happening.

BraedonLeonard avatar Jun 14 '23 16:06 BraedonLeonard

We currently use yaspin for this purpose in the Cloud CLI. Example:

https://github.com/meltano/meltano/blob/47d1d3dfc0c372a8289e73ba0509eb381872e2c6/src/cloud-cli/meltano/cloud/cli/deployment.py#L412-L419

That is to say, we can easily use this elsewhere in the Meltano CLI, and we won't have to add any additional dependencies to do so.

WillDaSilva avatar Jun 21 '23 22:06 WillDaSilva

@WillDaSilva @BraedonLeonard can I pick this?

ashu565 avatar Sep 23 '23 07:09 ashu565

Sure thing @ashu565!

WillDaSilva avatar Sep 23 '23 15:09 WillDaSilva

@WillDaSilva can I take this up if no one is working? Also I was thinking to do something like this in meltano/src/meltano/cli/add.py: add()

if not flags.get("no_install"):
-    success = install_plugins(
-        project,
-        plugins,
-        reason=PluginInstallReason.ADD,
-        force=flags.get("force_install", False),
-    )

if not flags.get("no_install"):
+    with yaspin(
+       text="Installing Plugins - this may take several minutes...",
+    ):
+       success = install_plugins(
+           project,
+           plugins,
+           reason=PluginInstallReason.ADD,
+           force=flags.get("force_install", False),
+       )

Please let me know if I'm on the right track. Thanks!

heyatulrai avatar Oct 12 '23 17:10 heyatulrai

@raiatul14 That seems like the right track. We should give @ashu565 a day or so to see if they've got anything in the works, or if they're not planning on completing this anytime soon. If they aren't (or don't say anything), then please feel free to implement this.

WillDaSilva avatar Oct 12 '23 17:10 WillDaSilva

@WillDaSilva I tried to add the yaspin() snippet inside src/meltano/cli/utils.py::install_status_update() like below:

if install_state.status in {
        PluginInstallStatus.RUNNING,
        PluginInstallStatus.SKIPPED,
    }:
        with yaspin().bold.blink.magenta.bouncingBall.on_cyan:
            msg = f"{install_state.verb} {desc} '{plugin.name}'..."
            click.secho(msg)

It works something like this

Screenshot 2023-10-14 at 12 08 30 AM

Doesn't seem very convincing to me. Do you have any thoughts around this or can you guide me further please? Thanks!

heyatulrai avatar Oct 13 '23 18:10 heyatulrai

@raiatul14 The cloud branch makes use of yaspin. It might be worth following its example.

WillDaSilva avatar Oct 13 '23 18:10 WillDaSilva

@WillDaSilva I have opened a PR related to this issue. Please review: https://github.com/meltano/meltano/pull/8234. If any changes required then please let me know. Thanks!

heyatulrai avatar Oct 20 '23 11:10 heyatulrai