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

Show image pull progress in a separate Echelon node #102

Merged
merged 1 commit into from
Sep 22, 2020

Conversation

fkorotkov
Copy link
Contributor

@fkorotkov fkorotkov commented Sep 22, 2020

No description provided.

@fkorotkov fkorotkov requested a review from edigaryev September 22, 2020 14:02
@edigaryev
Copy link
Contributor

I don't think this solves #11, since the progress is still hidden in ioutil.Discard.

@fkorotkov
Copy link
Contributor Author

There will be a timer. When you do docker pull you have separate progresses for each layer which is also confusing since it's not a percentage or time estimation. I think a timer will be good enough. What do you think?

@edigaryev
Copy link
Contributor

There will be a timer. When you do docker pull you have separate progresses for each layer which is also confusing since it's not a percentage or time estimation. I think a timer will be good enough. What do you think?

How are you going to calculate the total time needed to pull the image anyway?

Note that ImagePull returns an io.Reader that in turn returns JSON messages about each layer's progress separately:

{"status":"Pulling from golangci/golangci-lint","id":"latest"}
{"status":"Pulling fs layer","progressDetail":{},"id":"d6ff36c9ec48"}
{"status":"Pulling fs layer","progressDetail":{},"id":"c958d65b3090"}
{"status":"Pulling fs layer","progressDetail":{},"id":"edaf0a6b092f"}
{"status":"Pulling fs layer","progressDetail":{},"id":"80931cf68816"}
{"status":"Pulling fs layer","progressDetail":{},"id":"813643441356"}
{"status":"Pulling fs layer","progressDetail":{},"id":"2c05b70ce67b"}
{"status":"Pulling fs layer","progressDetail":{},"id":"e82ad91b19e9"}
{"status":"Pulling fs layer","progressDetail":{},"id":"5d2e569cefef"}
{"status":"Waiting","progressDetail":{},"id":"813643441356"}
{"status":"Waiting","progressDetail":{},"id":"2c05b70ce67b"}
{"status":"Waiting","progressDetail":{},"id":"e82ad91b19e9"}
{"status":"Waiting","progressDetail":{},"id":"5d2e569cefef"}
{"status":"Waiting","progressDetail":{},"id":"80931cf68816"}
{"status":"Downloading","progressDetail":{"current":81434,"total":7811570},"progress":"[\u003e                                                  ]  81.43kB/7.812MB","id":"c958d65b3090"}
{"status":"Downloading","progressDetail":{"current":101515,"total":9996337},"progress":"[\u003e                                                  ]  101.5kB/9.996MB","id":"edaf0a6b092f"}
{"status":"Downloading","progressDetail":{"current":736262,"total":7811570},"progress":"[====\u003e                                              ]  736.3kB/7.812MB","id":"c958d65b3090"}
[...]

You can combine them to get a total percentage that can be flushed to the log periodically.

@fkorotkov
Copy link
Contributor Author

Ok, let's not claim fixing #11 then.

progress, err := cli.ImagePull(ctx, params.Image, types.ImagePullOptions{})
if err != nil {
dockerPullLogger.Errorf("Failed to pull %s: $v", params.Image, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dockerPullLogger.Errorf("Failed to pull %s: $v", params.Image, err)
dockerPullLogger.Errorf("failed to pull %s: %v", params.Image, err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hold on, this is a user visible error level log

@fkorotkov fkorotkov merged commit 6c0ee7c into master Sep 22, 2020
@fkorotkov fkorotkov deleted the docker-pull-progress branch September 22, 2020 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants