[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-08 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/20682


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-02 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171803941
  
--- Diff: python/pyspark/ml/evaluation.py ---
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+import sys
+
--- End diff --

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


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-01 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171738801
  
--- Diff: python/pyspark/sql/conf.py ---
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 
+import sys
--- End diff --

Let's add a newline below


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-01 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171738756
  
--- Diff: python/pyspark/mllib/regression.py ---
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 
+import sys
--- End diff --

Let's reoprder this too

```
import sys
import warings

import numpy as np
...
```


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-01 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171738603
  
--- Diff: python/pyspark/ml/tuning.py ---
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 import itertools
+import sys
--- End diff --

Could we

```
import itertools
import sys
from multiprocessing.pool import ThreadPool

import numpy as np
...
```
?


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-01 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171738655
  
--- Diff: python/pyspark/mllib/random.py ---
@@ -19,6 +19,8 @@
 Python package for random data generation.
 """
 
+import sys
+
--- End diff --

Can we remove this newline?


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-01 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171738396
  
--- Diff: python/pyspark/ml/stat.py ---
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 
+import sys
--- End diff --

Shall we add a newline below?


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-03-01 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171738290
  
--- Diff: python/pyspark/heapq3.py ---
@@ -883,7 +883,7 @@ def nlargest(n, iterable, key=None):
 
 
 if __name__ == "__main__":
-import doctest
+import doctest, sys
--- End diff --

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


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171442417
  
--- Diff: python/pyspark/util.py ---
@@ -18,6 +18,8 @@
 
 __all__ = []
 
+import sys
+
--- End diff --

Oh, I see. Thanks!


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread benjaminp
Github user benjaminp commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171316860
  
--- Diff: python/pyspark/util.py ---
@@ -18,6 +18,8 @@
 
 __all__ = []
 
+import sys
+
--- End diff --

looks like the newline is required by lint. :)


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171190866
  
--- Diff: python/pyspark/ml/recommendation.py ---
@@ -480,4 +480,4 @@ def recommendForItemSubset(self, dataset, numUsers):
 except OSError:
 pass
 if failure_count:
-exit(-1)
+sys.exit(-1)
--- End diff --

need to import sys.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171191303
  
--- Diff: python/pyspark/mllib/evaluation.py ---
@@ -542,7 +542,7 @@ def _test():
 (failure_count, test_count) = doctest.testmod(globs=globs, 
optionflags=doctest.ELLIPSIS)
 spark.stop()
 if failure_count:
-exit(-1)
+sys.exit(-1)
--- End diff --

need to import sys.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171189077
  
--- Diff: python/pyspark/ml/clustering.py ---
@@ -1181,4 +1181,4 @@ def getKeepLastCheckpoint(self):
 except OSError:
 pass
 if failure_count:
-exit(-1)
+sys.exit(-1)
--- End diff --

need to import sys.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171190978
  
--- Diff: python/pyspark/ml/regression.py ---
@@ -1812,4 +1812,4 @@ def __repr__(self):
 except OSError:
 pass
 if failure_count:
-exit(-1)
+sys.exit(-1)
--- End diff --

need to import sys.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171191161
  
--- Diff: python/pyspark/mllib/classification.py ---
@@ -761,7 +761,7 @@ def _test():
 (failure_count, test_count) = doctest.testmod(globs=globs, 
optionflags=doctest.ELLIPSIS)
 spark.stop()
 if failure_count:
-exit(-1)
+sys.exit(-1)
--- End diff --

need to import sys.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171191678
  
--- Diff: python/pyspark/mllib/tree.py ---
@@ -654,7 +654,7 @@ def _test():
 (failure_count, test_count) = doctest.testmod(globs=globs, 
optionflags=doctest.ELLIPSIS)
 spark.stop()
 if failure_count:
-exit(-1)
+sys.exit(-1)
--- End diff --

need to import sys.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-28 Thread ueshin
Github user ueshin commented on a diff in the pull request:

https://github.com/apache/spark/pull/20682#discussion_r171192360
  
--- Diff: python/pyspark/util.py ---
@@ -18,6 +18,8 @@
 
 __all__ = []
 
+import sys
+
--- End diff --

nit: remove an extra line.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20682: [SPARK-23522][Python] always use sys.exit over bu...

2018-02-26 Thread benjaminp
GitHub user benjaminp opened a pull request:

https://github.com/apache/spark/pull/20682

[SPARK-23522][Python] always use sys.exit over builtin exit

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 `dev/run-tests`.

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


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/benjaminp/spark sys-exit

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/20682.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #20682


commit 311da8a16a82dbe1c28831a7b18fb035a2cdf739
Author: Benjamin Peterson 
Date:   2018-02-27T03:31:12Z

[SPARK-23522][Python] always use sys.exit over builtin exit

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




---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org