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

roachprod-microbench: add clean command #126810

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

sambhav-jain-16
Copy link
Contributor

Epic: none

Release note: None

This change adds a new utility command to roachprod-microbench as part of fixing #106661.

@sambhav-jain-16 sambhav-jain-16 requested a review from a team as a code owner July 8, 2024 10:34
@sambhav-jain-16 sambhav-jain-16 requested review from srosenberg and renatolabs and removed request for a team July 8, 2024 10:34
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@herkolategan herkolategan left a comment

Choose a reason for hiding this comment

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

Looks good, just a few minor comments.

pkg/cmd/roachprod-microbench/clean.go Outdated Show resolved Hide resolved
pkg/cmd/roachprod-microbench/clean.go Outdated Show resolved Hide resolved
@herkolategan
Copy link
Collaborator

Side note: You can add the description into the commit This change adds a new utility command to roachprod-microbench as part of fixing https://github.com/cockroachdb/cockroach/issues/106661. for easier reference. Usually GitHub copies the description in the first commit automatically to the PR desc.

@sambhav-jain-16 sambhav-jain-16 force-pushed the rm-clean-command branch 2 times, most recently from 7faacb2 to bd19424 Compare July 8, 2024 12:23
@sambhav-jain-16
Copy link
Contributor Author

TFTR !!

bors r=@herkolategan

@herkolategan
Copy link
Collaborator

bors cancel

@craig
Copy link
Contributor

craig bot commented Jul 8, 2024

Canceled.

Epic: none

Release note: None

Previously cleaning benchmark output was only internally exposed in roachprod-microbench, but we now need it as part of a CI job, hence a new utility command "clean" has been added to roachprod-microbench
See: cockroachdb#106661
@sambhav-jain-16
Copy link
Contributor Author

TFTR !!

bors r=@herkolategan

Copy link
Contributor

@renatolabs renatolabs left a comment

Choose a reason for hiding this comment

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

Minor comments!

For those of us with less context, it would have been helpful for the commit to be more substantial in the explanation provided (and also for future understandability).

In addition, it's not entirely clear to me how this is "part of fixing #106661" -- that issue refers to roachperf/macro benchmarks, and this is a change related to our microbenchmark infrastructure?


return command
}

func makeCleanCommand() *cobra.Command {
config := defaultCleanConfig()
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: this function is unnecessary; variables in Go are always initialized to their zero value1. This is equivalent to var config cleanConfig.

Footnotes

  1. https://go.dev/ref/spec#The_zero_value

func makeCleanCommand() *cobra.Command {
config := defaultCleanConfig()
runCmdFunc := func(cmd *cobra.Command, commandLine []string) error {
args, _ := splitArgsAtDash(cmd, commandLine)
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need splitArgsAtDash. This command doesn't seem to require or support any other args other than the two expected file paths.


func (c *clean) writeCleanOutputToFile(cleanedBenchmarkOutputLog benchmarkExtractionResult) error {

if err := os.MkdirAll(filepath.Dir(c.outputFilePath), os.ModePerm); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, I find this behaviour quite unusual for a command line utility: if I pass foo/bar/baz/path.txt to a command, I wouldn't expect it to create the entire directory tree to write to path.txt. It's generally better to have the caller be responsible for passing a valid path to begin with.

It makes handling these paths more explicit and also makes errors more evident, as writing to the path would fail if the path passed is invalid.

Copy link
Contributor Author

@sambhav-jain-16 sambhav-jain-16 Jul 9, 2024

Choose a reason for hiding this comment

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

@renatolabs Good point! Since this is meant to be added as a CI step, I was thinking it is fine we can create the directory in the code itself.

command := &cobra.Command{
Use: "clean <inputFilePath> <outputFilePath>",
Short: "remove noisy logs from the benchmark output and dump it to a file",
Long: `remove noisy logs from the benchmark output and dump it to a file`,
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand things right, this is kind of summarizing benchmark results and writing the summary to a file. Using remove here sounds like it's performing a destructive operation, which is not the case.

It's also unclear what "it" refers to in this sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, will update the documentation.

@craig craig bot merged commit 61a6b81 into cockroachdb:master Jul 8, 2024
21 of 22 checks passed
@sambhav-jain-16
Copy link
Contributor Author

In addition, it's not entirely clear to me how this is "part of fixing #106661" -- that issue refers to roachperf/macro benchmarks, and this is a change related to our microbenchmark infrastructure?

This PR doesn't fully fix the issue but adds a utility command in roachprod-microbench that will be used in the CI step that will be added in further PRs.

For those of us with less context, it would have been helpful for the commit to be more substantial in the explanation provided (and also for future understandability).

Noted. Thanks for pointing out !

sambhav-jain-16 added a commit to sambhav-jain-16/cockroach that referenced this pull request Jul 9, 2024
There were post-review comments in cockroachdb#126810. This change aims to address those.

Epic: none

Release note: None
sambhav-jain-16 added a commit to sambhav-jain-16/cockroach that referenced this pull request Jul 12, 2024
Epic: none

Release note: None

As part of fixing cockroachdb#106661, we need to run microbenchmarks in a CI job and compare the microbenchmarks with that of the latest master branch commit.

For this purpose we want to re-use `roachprod-microbench` compare command. However, as of current implementation of the compare command, it doesn't do threshold comparison and this PR aims to add that capability using a flag.

It is a follow up change to cockroachdb#126810 which exposed `roachprod-microbench` capability of cleaning the benchmark output.
craig bot pushed a commit that referenced this pull request Jul 16, 2024
126884: roachprod-microbench: address review comments in clean command r=renatolabs a=sambhav-jain-16

There were post-review comments in #126810. This change aims to address those.

Epic: none

Release note: None

Co-authored-by: Sambhav Jain <[email protected]>
sambhav-jain-16 added a commit to sambhav-jain-16/cockroach that referenced this pull request Jul 16, 2024
Epic: none

Release note: None

As part of fixing cockroachdb#106661, we need to run microbenchmarks in a CI job and compare the microbenchmarks with that of the latest master branch commit.

For this purpose we want to re-use `roachprod-microbench` compare command. However, as of current implementation of the compare command, it doesn't do threshold comparison and this PR aims to add that capability using a flag.

It is a follow up change to cockroachdb#126810 which exposed `roachprod-microbench` capability of cleaning the benchmark output.
sambhav-jain-16 added a commit to sambhav-jain-16/cockroach that referenced this pull request Jul 17, 2024
Epic: none

Release note: None

As part of fixing cockroachdb#106661, we need to run microbenchmarks in a CI job and compare the microbenchmarks with that of the latest master branch commit.

For this purpose we want to re-use `roachprod-microbench` compare command. However, as of current implementation of the compare command, it doesn't do threshold comparison and this PR aims to add that capability using a flag.

This change also adds a flag `--publish-sheets` to optionally allow publishing google sheets or not.

It is a follow up change to cockroachdb#126810 which exposed `roachprod-microbench` capability of cleaning the benchmark output.
sambhav-jain-16 added a commit to sambhav-jain-16/cockroach that referenced this pull request Jul 19, 2024
Epic: none

Release note: None

As part of fixing
cockroachdb#106661, we need to run
microbenchmarks in a CI job and compare the microbenchmarks with that of
the latest master branch commit.

For this purpose we want to re-use `roachprod-microbench` compare
command. However, as of current implementation of the compare command,
it doesn't do threshold comparison and this PR aims to add that
capability using a flag.

This change also adds a flag `--publish-sheets` to optionally allow
publishing google sheets.

It is a follow up change to
cockroachdb#126810 which exposed
`roachprod-microbench` capability of cleaning the benchmark output.
craig bot pushed a commit that referenced this pull request Jul 22, 2024
126885: roachprod-microbench: add threshold flag to compare command r=herkolategan a=sambhav-jain-16

Epic: none

Release note: None

As part of fixing #106661, we need to run microbenchmarks in a CI job and compare the microbenchmarks with that of the latest master branch commit.

For this purpose we want to re-use `roachprod-microbench` compare command. However, as of current implementation of the compare command, it doesn't do threshold comparison and this PR aims to add that capability using a flag.

This change also adds a flag `--publish-sheets` to optionally allow publishing google sheets or not.

It is a follow up change to #126810 which exposed `roachprod-microbench` capability of cleaning the benchmark output.

Co-authored-by: Sambhav Jain <[email protected]>
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.

4 participants