Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Long running commands should include a spinner animation #7803

Open
BraedonLeonard opened this issue Jun 14, 2023 · 8 comments
Open

Comments

@BraedonLeonard
Copy link
Contributor

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.

@WillDaSilva
Copy link
Member

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

with yaspin(
text="Creating deployment - this may take several minutes...",
), _raise_with_details():
deployment = await client.update_deployment(
deployment_name=deployment_name,
environment_name=environment_name,
git_rev=git_rev,
)

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.

@ashu565
Copy link
Contributor

ashu565 commented Sep 23, 2023

@WillDaSilva @BraedonLeonard can I pick this?

@WillDaSilva
Copy link
Member

Sure thing @ashu565!

@raiatul14
Copy link
Contributor

@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!

@WillDaSilva
Copy link
Member

@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.

@raiatul14
Copy link
Contributor

@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!

@WillDaSilva
Copy link
Member

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

@raiatul14
Copy link
Contributor

@WillDaSilva I have opened a PR related to this issue. Please review: #8234.
If any changes required then please let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants