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: Support for build image update when exec build or up again #570

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

aseaday
Copy link
Member

@aseaday aseaday commented Jul 7, 2022

Signed-off-by: Qi Chen aseaday@hotmail.com

Signed-off-by: Qi Chen <aseaday@hotmail.com>
@aseaday
Copy link
Member Author

aseaday commented Jul 7, 2022

It is not a formal PR but for your own exp.

I found some problems when check updates between image and manifest files.
if the manifest changed like A->B->A, the newest image woule always at a old time as the first A maybe caused by the cache system. So when you execute envd up, it would always build image again according the current implementation: It just compare the timestamp between image and manifest.

We could only accept this problem or we introduce a hash of the manifest and label it on the image:

Hash(manifest.AST + pubkey + config_file)

Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 🎉 👍

@@ -120,7 +120,50 @@ func (b generalBuilder) NumGPUs() int {
return ir.NumGPUs()
}

// Always return updated when met error
func (b generalBuilder) CheckDepsFileUpdate(ctx context.Context, tag string, deps []string) (bool, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fancy implementation!

I am not sure how docker deals with the ImageCreateTime in our case. Did you test the logic locally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test it. It seems that depends the tarball from the buildkit. So it could be cached if llb didn't change.

func (b generalBuilder) Build(ctx context.Context, pub string) error {
depsFiles := []string{
pub,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what pub is, could you please explain more about it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pub key is filepath "/home/aseaday/.config/envd/id_rsa_envd.pub". I think It can be changed if users bootstrap again. So it need to be added into depsFiles.

@gaocegege gaocegege requested a review from VoVAllen July 8, 2022 04:48
Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

cc @VoVAllen

Please have a look since it is related to ssh part.

Copy link
Member

@VoVAllen VoVAllen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice check on the dependencies!

@gaocegege gaocegege merged commit 6cfc0f1 into tensorchord:main Jul 8, 2022
@gaocegege
Copy link
Member

It is not a formal PR but for your own exp.

I found some problems when check updates between image and manifest files. if the manifest changed like A->B->A, the newest image woule always at a old time as the first A maybe caused by the cache system. So when you execute envd up, it would always build image again according the current implementation: It just compare the timestamp between image and manifest.

We could only accept this problem or we introduce a hash of the manifest and label it on the image:

Hash(manifest.AST + pubkey + config_file)

Maybe we should document it in envd docs.

@aseaday aseaday deleted the feat/envd_build_skip branch July 12, 2022 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants