zenml-io / mlstacks

A series of Terraform based recipes to provision popular MLOps stacks on the cloud.
https://mlstacks.zenml.io/
Apache License 2.0
247 stars 32 forks source link

Implement `rich` Progress Bars for CLI Commands in `mlstacks` #125

Open strickvl opened 9 months ago

strickvl commented 9 months ago

Open Source Contributors Welcomed!

Please comment below if you would like to work on this issue!

Contact Details [Optional]

support@zenml.io

What happened?

Currently, the mlstacks CLI lacks visual feedback in the form of progress bars or spinners when executing commands like mlstacks deploy ... or mlstacks destroy .... This can leave users uncertain about the progress or status of these commands.

Task Description

Integrate Rich progress bars into the mlstacks CLI to provide users with real-time visual feedback when executing commands. The goal is to enhance the user experience by making the interface more interactive and informative without overwhelming the user with excessive visuals.

Expected Outcome

Steps to Implement

Additional Context

This enhancement aims to improve the overall user experience of the mlstacks CLI, making it more engaging and informative, which is especially helpful in managing expectations during longer-running processes.

Code of Conduct

code-master-ajay commented 9 months ago

I would like to take this up.

strickvl commented 9 months ago

Great. Let me know if you have any questions about this, and def take a look at our sister repo where we do similar things with progress bars etc.

code-master-ajay commented 9 months ago

Sure, thanks for letting me contribute.

strickvl commented 8 months ago

@code-master-ajay any progress on this or questions about the implementation / approach you want to take?

code-master-ajay commented 8 months ago

Hi @strickvl, i looked up rich library and tried to use it with the terraform deploy function, but i am not able to get the terraform output in the code to be able to show the progress.

please let me know if i am doing something wrong, or should i try any other approach. Sorry for the delayed update.

strickvl commented 8 months ago

So I think it might be as simple as emulating how we handle it here: https://github.com/zenml-io/zenml/blob/cdd14528d674e0cafe00173755e556ea00c6343c/src/zenml/cli/integration.py#L274.

I.e. using the context handler around the deployment call. But in any case would be useful to see specifically what you tried as it's hard to give feedback without more information.

code-master-ajay commented 8 months ago

i was trying to capture the stdout of tf.apply function, and create a progress bar like this :

Terraform Deployment ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--

Which would show the progress percentage and estimated time.

We could read the stdout if we use subprocess but i can't figure out how to do it using the terraform python library.

From the link you have shared i guess we just need to show a static line like Deploying stack ... until the terraform runs.

strickvl commented 8 months ago

Yeah no need to make it so complicated, I think :) The console.status() method shows a spinner, so I think that's basically what we're looking for.

code-master-ajay commented 8 months ago

Sure @strickvl , I will do that . Thanks for the guidance :)