feature: Long running commands should include a spinner animation
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.
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 @BraedonLeonard can I pick this?
Sure thing @ashu565!
@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!
@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 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
Doesn't seem very convincing to me. Do you have any thoughts around this or can you guide me further please? Thanks!
@raiatul14 The cloud branch makes use of yaspin. It might be worth following its example.
@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!