Skip to content

Conversation

@benjaminp
Copy link
Contributor

@benjaminp benjaminp commented Feb 27, 2018

The exit() builtin is only for interactive use. applications should use sys.exit().

What changes were proposed in this pull request?

All usage of the builtin exit() function is replaced by sys.exit().

How was this patch tested?

I ran python/run-tests.

Please review http://spark.apache.org/contributing.html before opening a pull request.

@felixcheung
Copy link
Member

@HyukjinKwon @ueshin @holdenk

Copy link
Member

@ueshin ueshin left a comment

Choose a reason for hiding this comment

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

I'm not exactly sure the difference between exit() and sys.exit(), but found some missing imports and a nit.

Copy link
Member

Choose a reason for hiding this comment

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

need to import sys.

Copy link
Member

Choose a reason for hiding this comment

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

need to import sys.

Copy link
Member

Choose a reason for hiding this comment

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

need to import sys.

Copy link
Member

Choose a reason for hiding this comment

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

need to import sys.

Copy link
Member

Choose a reason for hiding this comment

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

need to import sys.

Copy link
Member

Choose a reason for hiding this comment

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

need to import sys.

Copy link
Member

Choose a reason for hiding this comment

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

nit: remove an extra line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like the newline is required by lint. :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see. Thanks!

@ueshin
Copy link
Member

ueshin commented Feb 28, 2018

ok to test.

@SparkQA
Copy link

SparkQA commented Feb 28, 2018

Test build #87769 has finished for PR 20682 at commit 311da8a.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Feb 28, 2018

Test build #87768 has finished for PR 20682 at commit 311da8a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

Seems fine but I think I need to double check the difference too before actually merging it.

The exit() builtin is only for interactive use. applications should use sys.exit().
@benjaminp
Copy link
Contributor Author

Thanks for the review and sorry about the missing sys imports. I guess my script to add them was buggy. Should be fixed now.

@SparkQA
Copy link

SparkQA commented Feb 28, 2018

Test build #87788 has finished for PR 20682 at commit 96529ca.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@holdenk
Copy link
Contributor

holdenk commented Feb 28, 2018

So quick reference for anyone looking for the python docs on why should use sys exit: https://docs.python.org/3/library/constants.html#constants-added-by-the-site-module

@SparkQA
Copy link

SparkQA commented Feb 28, 2018

Test build #87790 has finished for PR 20682 at commit 3d28bbf.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya
Copy link
Member

viirya commented Mar 1, 2018

retest this please.

@SparkQA
Copy link

SparkQA commented Mar 1, 2018

Test build #87815 has finished for PR 20682 at commit 3d28bbf.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please.

@SparkQA
Copy link

SparkQA commented Mar 1, 2018

Test build #87833 has finished for PR 20682 at commit 3d28bbf.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.


if __name__ == "__main__":
import doctest
import doctest, sys
Copy link
Member

Choose a reason for hiding this comment

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

Shell we import this separately? - https://www.python.org/dev/peps/pep-0008/#imports

# limitations under the License.
#

import sys
Copy link
Member

Choose a reason for hiding this comment

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

Shall we add a newline below?

# limitations under the License.
#
import itertools
import sys
Copy link
Member

Choose a reason for hiding this comment

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

Could we

import itertools
import sys
from multiprocessing.pool import ThreadPool

import numpy as np
...

?

"""

import sys

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 remove this newline?

# limitations under the License.
#

import sys
Copy link
Member

Choose a reason for hiding this comment

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

Let's reoprder this too

import sys
import warings

import numpy as np
...

# limitations under the License.
#

import sys
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a newline below

@HyukjinKwon
Copy link
Member

HyukjinKwon commented Mar 2, 2018

I think dev/run_tests doesn't actually test most of the changes (checking doctest failure) here because it needs a test failure. Can you check one of them with a manual test failure for sure? Running ./python/run_tests will be enough.

@benjaminp
Copy link
Contributor Author

I've now fixed the style as you suggest and got python/run-tests passing.

@SparkQA
Copy link

SparkQA commented Mar 2, 2018

Test build #87879 has finished for PR 20682 at commit 4dac3a7.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

#

import sys

Copy link
Member

Choose a reason for hiding this comment

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

Let's remove newline here. I think abc is is builtin one too.

@HyukjinKwon
Copy link
Member

lgtm otherwise

@SparkQA
Copy link

SparkQA commented Mar 2, 2018

Test build #87882 has finished for PR 20682 at commit 4dac3a7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 2, 2018

Test build #87891 has finished for PR 20682 at commit c1b7413.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Mar 7, 2018

Test build #88036 has finished for PR 20682 at commit c1b7413.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Mar 7, 2018

Test build #88042 has finished for PR 20682 at commit c1b7413.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

Merged to master.

@asfgit asfgit closed this in 7013eea Mar 8, 2018
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.

7 participants