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

feat(CLI): Set progress output mode to plain if --debug is set #383

Closed
gaocegege opened this issue Jun 16, 2022 · 1 comment
Closed

feat(CLI): Set progress output mode to plain if --debug is set #383

gaocegege opened this issue Jun 16, 2022 · 1 comment
Labels

Comments

@gaocegege
Copy link
Member

gaocegege commented Jun 16, 2022

Description

If we run envd --debug up, the log will be flushed by the output writer like this. It is random-ordered and cannot be read.

[+] ⌚ parse build.envd and download/cache dependencies 0.0s ✅ (finished) 
DEBU[2022-06-16T18:34:56+08:00] compiled build.envd                           tag="conda:dev"
DEBU[2022-06-16T18:34:56+08:00] serving grpc connection                      
DEBU[2022-06-16T18:34:56+08:00] loading image to docker host                  tag="conda:dev"
DEBU[2022-06-16T18:34:56+08:00] stop ticker and print build progress          console-height=40 console-width=166
[+] 🐋 build envd environment 0.0s (0/11) 
[+] 🐋 build envd environment 0.2s (1/25) r and print build progress          console-height=40 console-width=166
[+] 🐋 build envd environment 0.3s (1/25)                                                                                                                        0.0s
[+] 🐋 build envd environment 0.5s (1/25)                                                                                                                        0.0s

The new debug flag logic in pkg/app/up.go should be:

+	debug := clicontext.Bool("debug")
+
+	builder, err := builder.New(clicontext.Context, config, manifest, buildContext, tag, debug)
-	builder, err := builder.New(clicontext.Context, config, manifest, buildContext, tag)
	if err != nil {
		return errors.Wrap(err, "failed to create the builder")
	}

We can use plain mode instead of auto mode here https://github.com/tensorchord/envd/blob/main/pkg/builder/builder.go#L64 if --debug flag is enabled.

func New(ctx context.Context,
-	configFilePath, manifestFilePath, buildContextDir, tag string) (Builder, error) {
+	configFilePath, manifestFilePath, buildContextDir, tag string, debug bool) (Builder, error) {
+	var mode string = "auto"
+	if debug {
+		mode = "plain"
+	}
	b := &generalBuilder{
		manifestFilePath: manifestFilePath,
		configFilePath:   configFilePath,
		buildContextDir:  buildContextDir,
-		progressMode: "auto",
+ 		progressMode: mode,
		tag:          tag,
		logger: logrus.WithFields(logrus.Fields{
			"tag": tag,
		}),
	}
@issuelabeler issuelabeler bot added dependencies Pull requests that update a dependency file go Pull requests that update Go code labels Jun 16, 2022
@gaocegege gaocegege added good first issue ❤️ Good for newcomers help wanted 🆘 Extra attention is needed and removed go Pull requests that update Go code labels Jun 16, 2022
@gaocegege
Copy link
Member Author

Ref #382

kenwoodjw added a commit to kenwoodjw/envd that referenced this issue Jun 17, 2022
gaocegege pushed a commit that referenced this issue Jun 17, 2022
* feat #383

* fix linting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

No branches or pull requests

1 participant