tensorchord/envd

feat: Improve error message

pingsutw opened this issue · 0 comments

Describe the feature

Sometimes the build fails. It only returns error: invalid reference format. It's hard to troubleshoot.
It would be great if it shows a more useful message,
For example:

  • module not found
  • invalid syntax

My envd config

# syntax=v1

def build():
    base(image="cr.flyte.org/flyteorg/flytekit:py3.10-latest", dev=False)
    install.python_packages(name = ["pandas", "flytekit"])
    install.cuda(version="11.2.2", cudnn="8")
    runtime.environ(env={'PYTHONPATH': '/root', '_F_IMG_ID': 'pingsutw/flytekit:TB63-LOfI5n0DjYEvX4_OQ..'})
    install.python(version="3.9")

Why do you need this feature?

Make debug easy

Additional context

Error message when I turn on debug mode

DEBU[2023-06-09T23:35:40-07:00] /Users/kevin/.config/envd/id_rsa_envd.pub already present
DEBU[2023-06-09T23:35:40-07:00] /Users/kevin/.config/envd/id_rsa_envd already present
DEBU[2023-06-09T23:35:40-07:00] home manager initialized                      cache-dir=/Users/kevin/.cache/envd cache-map="map[oh-my-zsh:true]" cache-status=/Users/kevin/.cache/envd/cache.status config-file=/Users/kevin/.config/envd/config.envd context="{remote [{default docker-container buildkitd-demo docker <nil>} {remote tcp flyte:30091 docker <nil>}]}" context-file=/Users/kevin/.config/envd/contexts
DEBU[2023-06-09T23:35:40-07:00] telemetry initialization                      UID=4a7629be-4c68-47c8-a9d3-7eab841073c2
DEBU[2023-06-09T23:35:40-07:00] sending telemetry
DEBU[2023-06-09T23:35:40-07:00] tag not specified, using default
DEBU[2023-06-09T23:35:40-07:00] starting build command                        builder-options="{/var/folders/xp/_4ltv_bx3pb_r0bm00fk9z_00000gn/T/flyte-qw03nheb/sandbox/local_flytekit/f9361c817a08a7c155a36f3807cf0037/build.envd /Users/kevin/.config/envd/config.envd plain f9361c817a08a7c155a36f3807cf0037:dev /var/folders/xp/_4ltv_bx3pb_r0bm00fk9z_00000gn/T/flyte-qw03nheb/sandbox/local_flytekit/f9361c817a08a7c155a36f3807cf0037 build /Users/kevin/.config/envd/id_rsa_envd.pub    false }"
DEBU[2023-06-09T23:35:40-07:00] getting exporter entry                        entry="[]"
DEBU[2023-06-09T23:35:40-07:00] container is running, check if it's ready at tcp://flyte:30091...  container="flyte:30091" driver=tcp image="docker.io/moby/buildkit:v0.10.6" socket="flyte:30091"
DEBU[2023-06-09T23:35:40-07:00] waiting to connect to buildkitd               container="flyte:30091" driver=tcp image="docker.io/moby/buildkit:v0.10.6" socket="flyte:30091"
DEBU[2023-06-09T23:35:41-07:00] connected to buildkitd                        container="flyte:30091" driver=tcp image="docker.io/moby/buildkit:v0.10.6" socket="flyte:30091"
DEBU[2023-06-09T23:35:41-07:00] evaluating config file                        language-version=v1 tag="f9361c817a08a7c155a36f3807cf0037:dev"
DEBU[2023-06-09T23:35:41-07:00] interpret the file                            filename=/Users/kevin/.config/envd/config.envd
DEBU[2023-06-09T23:35:41-07:00] interpret the file                            filename=/var/folders/xp/_4ltv_bx3pb_r0bm00fk9z_00000gn/T/flyte-qw03nheb/sandbox/local_flytekit/f9361c817a08a7c155a36f3807cf0037/build.envd
DEBU[2023-06-09T23:35:41-07:00] Execute build func
DEBU[2023-06-09T23:35:41-07:00] rule `base` is invoked, image=cr.flyte.org/flyteorg/flytekit:py3.10-latest, dev=false  frontend=starlark
DEBU[2023-06-09T23:35:41-07:00] rule `install.python_packages` is invoked, name=[pandas flytekit], requirements=, local_wheels=[]  frontend=starlark
DEBU[2023-06-09T23:35:41-07:00] rule `install.cuda` is invoked, version=11.2.2, cudnn=8  frontend=starlark
DEBU[2023-06-09T23:35:41-07:00] rule `runtime.environ` is invoked, env: map[PYTHONPATH:/root _F_IMG_ID:pingsutw/flytekit:TB63-LOfI5n0DjYEvX4_OQ..], extra_path: []  frontend=starlark
DEBU[2023-06-09T23:35:41-07:00] rule `install.python` is invoked, version=3.9  frontend=starlark
DEBU[2023-06-09T23:35:41-07:00] failed to check manifest update: image with hash 72333a826090818328a4a43c459aef25 not found  language-version=v1 tag="f9361c817a08a7c155a36f3807cf0037:dev"
DEBU[2023-06-09T23:35:41-07:00] compile LLB                                   gid=501 uid=501
DEBU[2023-06-09T23:35:41-07:00] compile base image                            image="docker.io/nvidia/cuda:11.2.2-cudnn8-runtime-cr.flyte.org/flyteorg/flytekitpy3.10-latest" language="[{python 0x14000595cb0}]"
DEBU[2023-06-09T23:35:41-07:00] sending telemetry track event                 UID=4a7629be-4c68-47c8-a9d3-7eab841073c2 command=build
error: failed to build the image: failed to compile: failed to compile build.envd: failed to compile the graph: failed to get the base image: failed to parse image reference: invalid reference format
(1) attached stack trace
  -- stack trace:
  | github.com/tensorchord/envd/pkg/app/build.BuildImage
  | 	/home/runner/work/envd/envd/pkg/app/build/build.go:82
  | github.com/tensorchord/envd/pkg/app.build
  | 	/home/runner/work/envd/envd/pkg/app/build.go:132
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:274
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:267
  | github.com/urfave/cli/v2.(*App).RunContext
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:332
  | github.com/urfave/cli/v2.(*App).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:309
  | main.run
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:39
  | main.main
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:67
  | runtime.main
  | 	/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250
Wraps: (2) failed to build the image
Wraps: (3) attached stack trace
  -- stack trace:
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Build
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:130
  | github.com/tensorchord/envd/pkg/app/build.BuildImage
  | 	/home/runner/work/envd/envd/pkg/app/build/build.go:81
  | github.com/tensorchord/envd/pkg/app.build
  | 	/home/runner/work/envd/envd/pkg/app/build.go:132
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:274
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:267
  | github.com/urfave/cli/v2.(*App).RunContext
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:332
  | github.com/urfave/cli/v2.(*App).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:309
  | main.run
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:39
  | main.main
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:67
  | runtime.main
  | 	/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250
Wraps: (4) failed to compile
Wraps: (5) attached stack trace
  -- stack trace:
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Compile
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:168
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Build
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:128
  | github.com/tensorchord/envd/pkg/app/build.BuildImage
  | 	/home/runner/work/envd/envd/pkg/app/build/build.go:81
  | github.com/tensorchord/envd/pkg/app.build
  | 	/home/runner/work/envd/envd/pkg/app/build.go:132
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:274
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:267
  | github.com/urfave/cli/v2.(*App).RunContext
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:332
  | github.com/urfave/cli/v2.(*App).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:309
  | main.run
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:39
  | main.main
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:67
  | runtime.main
  | 	/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250
Wraps: (6) failed to compile build.envd
Wraps: (7) attached stack trace
  -- stack trace:
  | github.com/tensorchord/envd/pkg/lang/ir/v1.(*generalGraph).Compile
  | 	/home/runner/work/envd/envd/pkg/lang/ir/v1/compile.go:127
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Compile
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:166
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Build
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:128
  | github.com/tensorchord/envd/pkg/app/build.BuildImage
  | 	/home/runner/work/envd/envd/pkg/app/build/build.go:81
  | github.com/tensorchord/envd/pkg/app.build
  | 	/home/runner/work/envd/envd/pkg/app/build.go:132
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:274
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:267
  | github.com/urfave/cli/v2.(*App).RunContext
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:332
  | github.com/urfave/cli/v2.(*App).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:309
  | main.run
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:39
  | main.main
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:67
  | runtime.main
  | 	/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250
Wraps: (8) failed to compile the graph
Wraps: (9) attached stack trace
  -- stack trace:
  | github.com/tensorchord/envd/pkg/lang/ir/v1.(*generalGraph).CompileLLB
  | 	/home/runner/work/envd/envd/pkg/lang/ir/v1/compile.go:293
  | [...repeated from below...]
Wraps: (10) failed to get the base image
Wraps: (11) attached stack trace
  -- stack trace:
  | github.com/tensorchord/envd/pkg/lang/ir.FetchImageConfig
  | 	/home/runner/work/envd/envd/pkg/lang/ir/util.go:32
  | github.com/tensorchord/envd/pkg/lang/ir/v1.(*generalGraph).compileBaseImage
  | 	/home/runner/work/envd/envd/pkg/lang/ir/v1/system.go:336
  | github.com/tensorchord/envd/pkg/lang/ir/v1.(*generalGraph).CompileLLB
  | 	/home/runner/work/envd/envd/pkg/lang/ir/v1/compile.go:291
  | github.com/tensorchord/envd/pkg/lang/ir/v1.(*generalGraph).Compile
  | 	/home/runner/work/envd/envd/pkg/lang/ir/v1/compile.go:125
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Compile
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:166
  | github.com/tensorchord/envd/pkg/builder.generalBuilder.Build
  | 	/home/runner/work/envd/envd/pkg/builder/build.go:128
  | github.com/tensorchord/envd/pkg/app/build.BuildImage
  | 	/home/runner/work/envd/envd/pkg/app/build/build.go:81
  | github.com/tensorchord/envd/pkg/app.build
  | 	/home/runner/work/envd/envd/pkg/app/build.go:132
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:274
  | github.com/urfave/cli/v2.(*Command).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/command.go:267
  | github.com/urfave/cli/v2.(*App).RunContext
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:332
  | github.com/urfave/cli/v2.(*App).Run
  | 	/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.25.5/app.go:309
  | main.run
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:39
  | main.main
  | 	/home/runner/work/envd/envd/cmd/envd/main.go:67
  | runtime.main
  | 	/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/proc.go:250
  | runtime.goexit
  | 	/opt/hostedtoolcache/go/1.19.9/x64/src/runtime/asm_arm64.s:1172
Wraps: (12) failed to parse image reference
Wraps: (13) invalid reference format
Error types: (1) *withstack.withStack (2) *errutil.withPrefix (3) *withstack.withStack (4) *errutil.withPrefix (5) *withstack.withStack (6) *errutil.withPrefix (7) *withstack.withStack (8) *errutil.withPrefix (9) *withstack.withStack (10) *errutil.withPrefix (11) *withstack.withStack (12) *errutil.withPrefix (13) *errors.errorString