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

[DO NOT MERGE] Rewrite YAPF scripts #1971

Closed
wants to merge 15 commits into from
Closed

Conversation

alok
Copy link
Contributor

@alok alok commented May 1, 2018

What do these changes do?

  • Fixes YAPF to use existing .style.yapf config file
  • Runs in parallel
  • Easier to read yapf.sh (IMO)

Related issue number

No.

alok and others added 3 commits April 30, 2018 20:02
Any options not set in the config file defer to pep8.
This runs faster thanks to the `--parallel` flag and YAPF's builtin features.

It's also a little clearer (IMO), and was run through `shellcheck` to harden up
against a few of bash's many gotchas.

It also actually uses the .style.yapf in the project repo, which was previously ignored.
@pcmoritz
Copy link
Contributor

pcmoritz commented May 2, 2018

@ericl @richardliaw Are these linting changes ok with you? They look good to me!

@alok
Copy link
Contributor Author

alok commented May 2, 2018

Personally, I'd tweak the .style.yapf file a bit. I set mine up to imitate Elm's style guide in the areas where Python has no clear rules, and I think it's easier to read. I just used the pep8 style in this PR because that was what was specified before. I think it's harder to read this way though since it has odd indentation at times.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5139/
Test FAILed.

@alok
Copy link
Contributor Author

alok commented May 4, 2018

Regardless of the particular style used, we consider the updated script since it shaves about 30s off Travis builds.

cd to parent of script, then use git to find its own root.
@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5269/
Test PASSed.

alok added 2 commits May 9, 2018 09:05
format with yapf --style pep8 to satisfy travis
@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5290/
Test PASSed.

@alok alok closed this May 9, 2018
@alok alok reopened this May 9, 2018
1.  rm useless cd's
2.  Unquote array since it turns out checking the truthiness of an array
    is a real pain in bash and is best done in Python or something.
3.  rm useless `exit 0` since scripts exit with the status of the last
    command anyway.
@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5299/
Test PASSed.

Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

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

Some comments

@@ -507,8 +506,8 @@ def run(self):
log.debug("{} dead local schedulers, {} plasma managers total, {} "
"dead plasma managers".format(
len(self.dead_local_schedulers),
(len(self.live_plasma_managers) +
len(self.dead_plasma_managers)),
(len(self.live_plasma_managers) + len(
Copy link
Contributor

Choose a reason for hiding this comment

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

this one is also a little odd..

Copy link
Contributor

Choose a reason for hiding this comment

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

@alok can we revert this?

@@ -750,8 +750,8 @@ def micros_rel(ts):
"name":
"SubmitTask",
"args": {},
"id": (parent_info["worker_id"] +
str(micros(min(parent_times))))
"id": (parent_info["worker_id"] + str(
Copy link
Contributor

Choose a reason for hiding this comment

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

not a big fan of these

@@ -825,8 +825,8 @@ def micros_rel(ts):
"name":
"SubmitTask",
"args": {},
"id": (parent_info["worker_id"] +
str(micros(min(parent_times))))
"id": (parent_info["worker_id"] + str(
Copy link
Contributor

Choose a reason for hiding this comment

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

not a big fan of these

Copy link
Contributor

Choose a reason for hiding this comment

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

@alok can we revert this?

Added some trailing commas to make certain blocks neater. This style uses more
vertical space but is (IMO) significantly more readable for a lot of code since
you can just sort of scan each block independently since they're clearly
delineated from each other.

Feel free to revert to the last commit
@alok
Copy link
Contributor Author

alok commented May 10, 2018

@richardliaw See the latest commit where I apply the style specified in the config file. I went in and manually tweaked some code by adding trailing commas so the formatter would do the right thing. I think it fixed all your comments and hopefully looks fine for the rest. If not, feel free to revert it.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5309/
Test FAILed.

@richardliaw
Copy link
Contributor

OK I think there's too much vertical space as of this most recent commit; would you be willing to revert?

@alok
Copy link
Contributor Author

alok commented May 11, 2018

Done.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5326/
Test PASSed.

Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

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

two requests to change; otherwise looks good overall.

@@ -825,8 +825,8 @@ def micros_rel(ts):
"name":
"SubmitTask",
"args": {},
"id": (parent_info["worker_id"] +
str(micros(min(parent_times))))
"id": (parent_info["worker_id"] + str(
Copy link
Contributor

Choose a reason for hiding this comment

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

@alok can we revert this?

@@ -507,8 +506,8 @@ def run(self):
log.debug("{} dead local schedulers, {} plasma managers total, {} "
"dead plasma managers".format(
len(self.dead_local_schedulers),
(len(self.live_plasma_managers) +
len(self.dead_plasma_managers)),
(len(self.live_plasma_managers) + len(
Copy link
Contributor

Choose a reason for hiding this comment

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

@alok can we revert this?

@richardliaw richardliaw self-assigned this May 15, 2018
@alok
Copy link
Contributor Author

alok commented May 16, 2018

@richardliaw I'd rather tweak the formatting config until it ends up looking pretty to avoid ever having to worry about manual formatting. I want it to be reliable enough to become a git pre-push hook so no one ever has to comment about formatting again.

@alok alok mentioned this pull request May 16, 2018
alok added 2 commits May 16, 2018 17:51
It's better to have the occasional long line than to have very odd looking
code. The codebase has long lines anyway, so it's not like they're totally
verboten.
This should hopefully prevent some of the odder formatting.
alok added 3 commits May 16, 2018 17:53
This style looks fine to me and doesn't generally have a bunch of whitespace. A
few trailing commas to split lines correctly and it should be satisfactory to
everyone.
@alok
Copy link
Contributor Author

alok commented May 16, 2018

@richardliaw can you try out this style? i think it fixes (most) of your issues with the current one.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5425/
Test FAILed.

These should really be separate anyway.
@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/5432/
Test PASSed.

@richardliaw
Copy link
Contributor

Hey @alok how did this become a 4k line PR?

@alok
Copy link
Contributor Author

alok commented May 17, 2018

I made the mistake of actually committing the linting changes

@alok
Copy link
Contributor Author

alok commented May 17, 2018

Check out https://github.com/alok/ray/tree/yapf-take-2 for a clean version

@richardliaw
Copy link
Contributor

OK great take-2 looks a lot better. Consider making a commit that reverts changes from
6d2a24b onwards and then rebasing take-2 onto this.

@alok alok mentioned this pull request May 17, 2018
@alok alok changed the title Rewrite YAPF scripts [DO NOT MERGE] Rewrite YAPF scripts May 17, 2018
@alok
Copy link
Contributor Author

alok commented May 17, 2018

@richardliaw I ended up making a new branch from master and applying the necessary changes there. See #2083.

@alok alok mentioned this pull request May 19, 2018
@alok alok closed this May 19, 2018
@alok alok deleted the yapf branch May 21, 2018 20:15
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