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

docker: log image pulls #16849

Merged
merged 2 commits into from
Sep 14, 2022
Merged

docker: log image pulls #16849

merged 2 commits into from
Sep 14, 2022

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Sep 13, 2022

Log Docker image pulls, otherwise Pants will appear to hang if Pants decides it is necessary to pull an image.

[ci skip-build-wheels]

@tdyas tdyas added the category:internal CI, fixes for not-yet-released features, etc. label Sep 13, 2022
status: Some(status),
..
} => {
log::info!("Docker pull status: {status}");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is better as debug?

Copy link
Contributor Author

@tdyas tdyas Sep 13, 2022

Choose a reason for hiding this comment

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

These messages are what the user would see when running docker pull manually. I'd like to provide the same UX for the moment. If it's too chatty, we can always put it to debug level.

@tdyas tdyas enabled auto-merge (squash) September 13, 2022 21:32
}

log::info!("Finished pull of Docker image `{image}`.");
Copy link
Member

Choose a reason for hiding this comment

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

Consider using a workunit, rather than a pair of log messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. How should the status message be logged then? debug level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also the actual pull_image function is debounced via a OnceCell. Will that affect associating the work unit with the correct parent?

Copy link
Member

Choose a reason for hiding this comment

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

Good idea. How should the status message be logged then? debug level?

The workunit's level (and whether the UI is in use) drives how it is logged. When the UI is enabled, DEBUG or greater are rendered in the UI, but only INFO or greater have their completion logged. When the UI is disabled, debug won't render at all (unless it is a "Long running workunit..."), but INFO will render both start and end.

Also the actual pull_image function is debounced via a OnceCell. Will that affect associating the work unit with the correct parent?

It won't, no.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should the in_workunit! call be inside the OnceCell get_or_try_init or outside of it?

Copy link
Member

Choose a reason for hiding this comment

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

Inside. Otherwise the workunit will be created even if nothing needs to be done.

@tdyas tdyas disabled auto-merge September 13, 2022 21:38
Tom Dyas added 2 commits September 14, 2022 15:55
[ci skip-build-wheels]
[ci skip-build-wheels]
@tdyas tdyas merged commit ac447d1 into pantsbuild:main Sep 14, 2022
@tdyas tdyas deleted the docker_log_image_pulls branch September 14, 2022 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants