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

Add command line option to toggle parallel execution #349

Merged
merged 4 commits into from Apr 20, 2023

Conversation

meganemura
Copy link
Contributor

@meganemura meganemura commented Apr 19, 2023

What are you trying to accomplish?

Allows parallel configuration to be overridden by command line options.
This is useful if you want to switch parallel options between different execution environments, such as local and CI environments.

What approach did you choose and why?

I added the --parallel / --no-parallel option to the process of parsing command-line options by OptionParse.

What should reviewers focus on?

  • Changes adding an attr_ accessor to @parallel in the Configuration class.
  • That the test is against private methods. (fixed)

Type of Change

  • Bugfix
  • New feature
  • Non-breaking change (a change that doesn't alter functionality - i.e., code refactor, configs, etc.)

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • It is safe to rollback this change.

@meganemura meganemura marked this pull request as ready for review April 19, 2023 14:35
@meganemura meganemura requested a review from a team as a code owner April 19, 2023 14:35
Copy link
Contributor

@mclark mclark left a comment

Choose a reason for hiding this comment

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

This change makes sense to me. Just a minor wording suggestion. 👍

USAGE.md Outdated Show resolved Hide resolved
Co-authored-by: Matt Clark <44023+mclark@users.noreply.github.com>
@@ -296,5 +296,17 @@ def show_strict_mode_violations(_offenses)

cli.execute_command(["check", "--offenses-formatter=default", "--packages=components/platform"])
end

test "#parse_run (private) parses parallel option and overrides the configuration" do
Copy link
Member

Choose a reason for hiding this comment

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

Can we avoid calling the private method by calling the public interface and asserting the configuration object that we are already passing changed its value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rafaelfranca
Oops. It certainly could have been achieved that way.
What do you think of these changes?
f318c59

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for writing tests against the public interface! That means I can refactor without needing to change tests! 🙇🏻‍♂️

@meganemura
Copy link
Contributor Author

#351 looks great work.
Merging this pull request would lead to conflicts.
If #351 is going to be merged soon, it might be a good idea to prioritize it over this one, as resolving conflicts could be a bit of a hassle.
Once that's taken care of, I'll submit a new Pull Request, so please don't worry about me.

@rafaelfranca rafaelfranca merged commit 9967367 into Shopify:main Apr 20, 2023
20 checks passed
@davidstosik
Copy link
Contributor

Hello @meganemura. Thank you for your PR.

#351 looks great work.
Merging this pull request would lead to conflicts.

Thank you for worrying about this. It's okay, solving the merge conflicts was not too bad. It also allowed me to confirm that passing the parallel option to ParseRun instead of the whole Configuration object is heading in the right direction.

I opened a PR to make small adjustments to your test, would you mind taking a look? 🙏🏻
#352

@meganemura meganemura deleted the parallel-options branch April 21, 2023 02:13
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems August 8, 2023 20:48 Inactive
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.

None yet

4 participants