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

core/commands/pin: add verbose pin #6403

Closed

Conversation

reinerRubin
Copy link
Contributor

@reinerRubin reinerRubin commented Jun 4, 2019

Hello,
I have tried to add a verbose argument to the pinning command. It add output like this:

Pinning QmQZ1WVkddYPpRPm6vPpemhNacjwhupzSMzFEcYMisVpuY                                               
Pinning QmQeYwtLpXuEmvG9vWfRhoeyNgXYw5KExozDTHyp3vBQzc                                              

Currently this PR is more like a demo for the PR to go-merkledag [1].

@michaelavila

1 - ipfs/go-merkledag#38
#6042

Pins []string
Progress int `json:",omitempty"`
Pins []string
OngoingPins []string `json:",omitempty"`
Copy link
Contributor Author

@reinerRubin reinerRubin Jun 4, 2019

Choose a reason for hiding this comment

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

I am not sure about this json tags.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm actually not sure either. I'll look around.

fmt.Fprintf(os.Stderr,
"Pinning %s\n", pin)
}
} else if showDigitProgress {
Copy link
Contributor

@michaelavila michaelavila Jun 4, 2019

Choose a reason for hiding this comment

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

Should we also include the numeric progress while in verbose mode?

I'm kind of wondering whether there should really be separate verbose and progress modes. Maybe this work you're doing should expand the meaning of the progress flag instead of introducing a new one? cc @magik6k / @Stebalien do either of you have an opinion on whether or not we expand the progress flag to show more infomation? vs introducing a new flag for showing more verbose progress?

@michaelavila
Copy link
Contributor

@reinerRubin mind getting the latest master merged into this work so golint will run? (I think that's the issue).

@reinerRubin reinerRubin force-pushed the feat/cmds/pin-add-verbose-level branch from 64a3700 to 4f01773 Compare June 5, 2019 08:42
@reinerRubin
Copy link
Contributor Author

@michaelavila, I have done a rebase, but circleci shows that golint is ok:

ci/circleci: golint — Your tests passed on CircleCI!

@michaelavila
Copy link
Contributor

@reinerRubin great! that's what I suspected, but because you didn't have the golint configs it wasn't running on CI


test_expect_success "pin progress reported correctly" '
cat test_pin_verbose_progress_err
grep -q "Pinning" test_pin_verbose_progress_err
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we test for the whole line here? I think we have the hash available in $HASH, is that true?

Suggested change
grep -q "Pinning" test_pin_verbose_progress_err
grep -q "Pinning $HASH" test_pin_verbose_progress_err

Another thing that would be nice to have is a test that shows progress for recursively pinning a hash that has a root block and other blocks underneath it. I think that test can be approached the same as the test you have here.

What do you think?

Copy link
Contributor Author

@reinerRubin reinerRubin Jun 5, 2019

Choose a reason for hiding this comment

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

Fixed with $HASH.

This test partially checks this. The command output is:

Pinning QmQZ1WVkddYPpRPm6vPpemhNacjwhupzSMzFEcYMisVpuY
Pinning QmQeYwtLpXuEmvG9vWfRhoeyNgXYw5KExozDTHyp3vBQzc
Pinning QmSijovevteoY63Uj1uC5b8pkpDU5Jgyk2dYBqz3sMJUPc
Pinning QmThbpxkSVyP4kjfrMfbqWJsnqkSTk1pTXj4dD8GD5L9H3
Pinning QmTbPEyrA1JyGUHFvmtx1FNZVzdBreMv8Hc8jV9sBRWhNA

But there are no explicit checks for these cids. Probably we can ask ipfs what cids to expect before pinning (idk).

@michaelavila
Copy link
Contributor

@reinerRubin something else to consider: in the existing progress reporting implementation we just print to stderr, but I wonder if some (or all) of this should be captured in the logs. Our goal is already to introduce this robust progress reporting to help with debugging, it seems like capturing it in the logs would make it useful for even more debugging.

I'm curious, what are your thoughts on that?

License: MIT
Signed-off-by: Georgij Tolstov <[email protected]>
@reinerRubin reinerRubin force-pushed the feat/cmds/pin-add-verbose-level branch from 4f01773 to b191604 Compare June 5, 2019 17:47
@reinerRubin
Copy link
Contributor Author

@michaelavila, could you explain? I am not familiar with the ipfs logging system. Should pinned cids be written to the logs and stderr?

If so, I think, it should be logged at the go-merkledag level with or without "ProgressTracker", because usually logs level is a global setting.

@guseggert guseggert closed this Sep 15, 2021
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.

3 participants