envd icon indicating copy to clipboard operation
envd copied to clipboard

bug(CLI): fail to use both path and file flag in envd up

Open gaocegege opened this issue 2 years ago • 6 comments

envd up --path ./examples/mnist -f ./examples/mnist/build_gpu.envd 
error: no such file or directory

We use the path dir as the cwd, thus we cannot find the file ./examples/mnist/build_gpu.envd


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

gaocegege avatar Jun 18 '22 10:06 gaocegege

We can recording pwd as a global 'ENV_DIR' to support both path dir and the current dir.

Is it suitable?

popfido avatar Jun 20 '22 14:06 popfido

We can recording pwd as a global 'ENV_DIR' to support both path dir and the current dir.

Is it suitable?

Could you please explain more about it?

gaocegege avatar Jun 20 '22 14:06 gaocegege

We can recording pwd as a global 'ENV_DIR' to support both path dir and the current dir. Is it suitable?

Could you please explain more about it?

Just record the current working dir by using pwd() path as a secondary base search path when it is failed in using the path dir to find the file with-f.

popfido avatar Jun 20 '22 14:06 popfido

Gotcha, SGTM. I think it works.

gaocegege avatar Jun 20 '22 14:06 gaocegege

Is there a bug in https://github.com/tensorchord/envd/blob/53d8e13fc3cf39cd8a1c38e80d411096dd99e234/pkg/builder/util.go#L321-L338

So no matter what you pass to -f, it will always use the defaultbuild.envd. (Unless you specify the target function)

BTW, the -f description is "Function to execute, format file:func". Should we use filepath.Base() to extract the last element?

kemingy avatar Aug 10 '22 09:08 kemingy

I think it is a bug.

gaocegege avatar Aug 10 '22 10:08 gaocegege