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

    https://github.com/apache/spark/pull/7031#discussion_r33521735
  
    --- Diff: python/run-tests.py ---
    @@ -43,34 +50,43 @@ def print_red(text):
     
     
     LOG_FILE = os.path.join(SPARK_HOME, "python/unit-tests.log")
    +LOG_FILE_LOCK = Lock()
    +LOGGER = logging.getLogger()
     
     
     def run_individual_python_test(test_name, pyspark_python):
         env = {'SPARK_TESTING': '1', 'PYSPARK_PYTHON': which(pyspark_python)}
    -    print("    Running test: %s ..." % test_name, end='')
    +    LOGGER.info("Starting test(%s): %s", pyspark_python, test_name)
         start_time = time.time()
    -    with open(LOG_FILE, 'a') as log_file:
    -        retcode = subprocess.call(
    -            [os.path.join(SPARK_HOME, "bin/pyspark"), test_name],
    -            stderr=log_file, stdout=log_file, env=env)
    +    per_test_output = tempfile.TemporaryFile()
    +    retcode = subprocess.Popen(
    +        [os.path.join(SPARK_HOME, "bin/pyspark"), test_name],
    +        stderr=per_test_output, stdout=per_test_output, env=env).wait()
         duration = time.time() - start_time
    +    with LOG_FILE_LOCK:
    +        with open(LOG_FILE, 'ab') as log_file:
    +            per_test_output.seek(0)
    --- End diff --
    
    TODO: only need to print the log when the test fails.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to