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

directoryStructure set to <artifact_name> and not prepended by model/ dir #200

Open
gbolmier opened this issue Jan 12, 2022 · 4 comments
Open
Labels
question Further information is requested

Comments

@gbolmier
Copy link
Contributor

/kind bug

I noticed a strange behaviour when I save and push an artifact from the root level of my docker container (python:3.7-slim). The directoryStructure metadata field is set to my artifact name without the ORMBModelDirectory prepended to it, but if I run the save and push commands from the /home directory of my container then I observe the "expected normal" behaviour and the directoryStructure metadata field is set to model/<artifact_name> 😅

I know I should not do that at the root level of my containers but I don't understand what is causing this result. I don't know go but I feel like this is related to it:

ormb/pkg/saver/saver.go

Lines 127 to 129 in 7907828

// update the name to correctly reflect the desired destination when untaring
header.Name = strings.TrimPrefix(
strings.Replace(file, parentDir, "", -1), string(filepath.Separator))

Any idea where this is coming from and if this is expected in that situation?

@gaocegege
Copy link
Member

Interesting. I will dive into this issue.

@gaocegege gaocegege added the question Further information is requested label Jan 13, 2022
@gaocegege
Copy link
Member

Do you have any clue about it now?

@gbolmier
Copy link
Contributor Author

I'm actually getting more confused now. I run the following:

$ docker pull python:3.7-slim
$ docker run --rm -it --entrypoint /bin/bash python:3.7-slim

root@:/$ apt-get update
root@:/$ apt-get install vim-tiny -y
root@:/$ vi home/.env  # populating my harbor credentials
root@:/$ mkdir home/test-model
root@:/$ mkdir home/test-model/model
root@:/$ touch home/test-model/model/test-model.joblib
root@:/$ echo "format: SKLearn" >> home/test-model/ormbfile.yaml
root@:/$ pip install python-dotenv ormb
root@:/$ python

Python 3.7.12 (default, Dec 21 2021, 11:35:10) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import ormb
>>> import dotenv
>>> dotenv.load_dotenv(dotenv_path="home/.env")
True
>>> username = os.getenv("HARBOR_USERNAME")
>>> password = os.getenv("HARBOR_PASSWORD")
>>> ormb.login(hostname="****", username=username, password=password, insecure_opt="true")
Using /root/.ormb as the root path
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login insecurely
WARN[0000] insecure registry **** should not contain 'https://' and 'https://' has been removed from the insecure registry config 
Login succeeded
0
>>> ref = "****"
>>> ormb.save(src="home/test-model", ref=ref)
Using config file: /root/.ormb/config.json
Using /root/.ormb as the root path
ref:       ****
digest:    705e6b425763259c7a743b9ea2abcb9228cc85374f72ecc6a96535f55aa2f781
size:      113 B
format:    SKLearn
: saved
0
>>> ormb.push(ref=ref)
Using config file: /root/.ormb/config.json
Using /root/.ormb as the root path
The push refers to repository [****]
ref:       ****
digest:    705e6b425763259c7a743b9ea2abcb9228cc85374f72ecc6a96535f55aa2f781
size:      113 B
format:    SKLearn
: pushed to remote (1 layer, 113 B total)
0

which resulted in no directoryStructure metadata field set at all...

Screenshot 2022-01-13 at 14 12 27

@gaocegege
Copy link
Member

I cannot reproduce it locally with ormb binary. I will try the python sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants