Github user holdenk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11197#discussion_r52971131
  
    --- Diff: python/pyspark/ml/clustering.py ---
    @@ -310,7 +303,17 @@ def _create_model(self, java_model):
         sqlContext = SQLContext(sc)
         globs['sc'] = sc
         globs['sqlContext'] = sqlContext
    -    (failure_count, test_count) = doctest.testmod(globs=globs, 
optionflags=doctest.ELLIPSIS)
    -    sc.stop()
    +    import tempfile
    +    temp_path = tempfile.mkdtemp()
    +    globs['temp_path'] = temp_path
    +    try:
    +        (failure_count, test_count) = doctest.testmod(globs=globs, 
optionflags=doctest.ELLIPSIS)
    +        sc.stop()
    +    finally:
    --- End diff --
    
    So finally is still useful even if we don't explicitly catch/handle any 
exceptions - are you saying the sc.stop and doctest will never throw any 
exceptions?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to