-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23522][Python] always use sys.exit over builtin exit #20682
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
Conversation
ueshin
left a comment
There was a problem hiding this 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.
python/pyspark/ml/clustering.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import sys.
python/pyspark/ml/recommendation.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import sys.
python/pyspark/ml/regression.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import sys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import sys.
python/pyspark/mllib/evaluation.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import sys.
python/pyspark/mllib/tree.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to import sys.
python/pyspark/util.py
Outdated
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Thanks!
|
ok to test. |
|
Test build #87769 has finished for PR 20682 at commit
|
|
Test build #87768 has finished for PR 20682 at commit
|
|
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().
|
Thanks for the review and sorry about the missing |
|
Test build #87788 has finished for PR 20682 at commit
|
|
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 |
|
Test build #87790 has finished for PR 20682 at commit
|
|
retest this please. |
|
Test build #87815 has finished for PR 20682 at commit
|
|
retest this please. |
|
Test build #87833 has finished for PR 20682 at commit
|
python/pyspark/heapq3.py
Outdated
|
|
||
| if __name__ == "__main__": | ||
| import doctest | ||
| import doctest, sys |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
...
?
python/pyspark/mllib/random.py
Outdated
| """ | ||
|
|
||
| import sys | ||
|
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
|
I think |
|
I've now fixed the style as you suggest and got |
|
Test build #87879 has finished for PR 20682 at commit
|
|
retest this please |
python/pyspark/ml/evaluation.py
Outdated
| # | ||
|
|
||
| import sys | ||
|
|
There was a problem hiding this comment.
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.
|
lgtm otherwise |
|
Test build #87882 has finished for PR 20682 at commit
|
|
Test build #87891 has finished for PR 20682 at commit
|
|
retest this please |
|
Test build #88036 has finished for PR 20682 at commit
|
|
retest this please |
|
Test build #88042 has finished for PR 20682 at commit
|
|
Merged to master. |
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 bysys.exit().How was this patch tested?
I ran
python/run-tests.Please review http://spark.apache.org/contributing.html before opening a pull request.