[GitHub] spark pull request #22523: [MINOR][PYSPARK] Always Close the tempFile in _se...

2018-09-22 Thread asfgit
Github user asfgit closed the pull request at:

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


---

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



[GitHub] spark pull request #22523: [MINOR][PYSPARK] Always Close the tempFile in _se...

2018-09-22 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/22523#discussion_r219686544
  
--- Diff: python/pyspark/context.py ---
@@ -537,8 +537,10 @@ def _serialize_to_jvm(self, data, serializer, 
reader_func, createRDDServer):
 # parallelize from there.
 tempFile = NamedTemporaryFile(delete=False, dir=self._temp_dir)
--- End diff --

Actually, we better use a context manager:

```python
with NamedTemporaryFile(delete=False, dir=self._temp_dir) as tempfile:
...
```

but not a big deal. LGTM


---

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