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

Improve image build waiting mechanism #79

Closed
pditommaso opened this issue Aug 3, 2022 · 4 comments · Fixed by #98
Closed

Improve image build waiting mechanism #79

pditommaso opened this issue Aug 3, 2022 · 4 comments · Fixed by #98

Comments

@pditommaso
Copy link
Collaborator

pditommaso commented Aug 3, 2022

Wave can build container on-fly when the container request provides a dockerfile.

https://github.com/seqeralabs/wave/blob/2b24fb330bab6220870141140f62164ed7404e4e/wave-api/src/main/groovy/io/seqera/wave/api/SubmitContainerTokenRequest.groovy#L30-L30

However, the build process can take some minutes. Therefore subsequence image requests need to wait for the build completion before starting to pull the corresponding layers.

Now it's uses a very simple blicking mechanism in the controller handler.

https://github.com/seqeralabs/wave/blob/2b24fb330bab6220870141140f62164ed7404e4e/src/main/groovy/io/seqera/wave/controller/RegistryProxyController.groovy#L62-L63

But this can be very inefficient. Likely a better approach consistent using reactive response.

Also the build response status should be taken into account an return an error when the build fails

@pditommaso pditommaso changed the title Improve image build waiting mechanism, Improve image build waiting mechanism Aug 3, 2022
@jorgeaguileraseqera
Copy link
Contributor

Seems Docker inspects the Retry-After header if a 50x error is returned but I'll confirm this error with pull is solved:

https://forums.docker.com/t/force-docker-client-to-retry-pulling-layers/31947

by other hand, I think the best approach is to create a background task that performs the build when the dockerfile is provided and store the result in some storage. When the docker client request again we can check if it's present in the storage and serve it

@pditommaso
Copy link
Collaborator Author

by other hand, I think the best approach is to create a background task that performs the build when the dockerfile is provided and store the result in some storage

this is how it works! look here

https://github.com/seqeralabs/wave/blob/26a9fe70b3cb2806b8e96dcb5b5a69a265292b0f/src/main/groovy/io/seqera/wave/service/builder/ContainerBuildServiceImpl.groovy#L183-L183

@jorgeaguileraseqera
Copy link
Contributor

I prefer to use the background task feature of Micronaut (https://guides.micronaut.io/latest/micronaut-scheduled-gradle-groovy.html#scheduling-a-job-manually)

@pditommaso
Copy link
Collaborator Author

Dont' think impact much, it's just another way to execute the task in a separate thread.

jorgeaguileraseqera added a commit that referenced this issue Aug 11, 2022
delegate into MN the wait for image build completion

closes #79
jorgeaguileraseqera added a commit that referenced this issue Aug 12, 2022
delegate into MN the wait for image build completion

closes #79
jorgeaguileraseqera added a commit that referenced this issue Aug 14, 2022
delegate into MN the wait for image build completion

closes #79
jorgeaguileraseqera added a commit that referenced this issue Aug 16, 2022
delegate into MN the wait for image build completion

closes #79
jorgeaguileraseqera added a commit that referenced this issue Aug 16, 2022
delegate into MN the wait for image build completion

closes #79
jorgeaguileraseqera added a commit that referenced this issue Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants