You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/04/06 12:59:57 UTC

[airflow] branch master updated: Use context manager to manage pools (#15220)

This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 36d9274  Use context manager to manage pools (#15220)
36d9274 is described below

commit 36d9274f4ea87f28e2dcbab393b21e34a04eec30
Author: Kamil BreguĊ‚a <mi...@users.noreply.github.com>
AuthorDate: Tue Apr 6 14:59:38 2021 +0200

    Use context manager to manage pools (#15220)
---
 docs/build_docs.py | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/docs/build_docs.py b/docs/build_docs.py
index 09d9561..c0b9b81 100755
--- a/docs/build_docs.py
+++ b/docs/build_docs.py
@@ -291,23 +291,23 @@ def run_in_parallel(
     verbose,
 ):
     """Run both - spellcheck and docs build sequentially without multiprocessing"""
-    pool = multiprocessing.Pool(processes=jobs)
-    if not spellcheck_only:
-        run_docs_build_in_parallel(
-            all_build_errors=all_build_errors,
-            for_production=for_production,
-            current_packages=current_packages,
-            verbose=verbose,
-            pool=pool,
-        )
-    if not docs_only:
-        run_spell_check_in_parallel(
-            all_spelling_errors=all_spelling_errors,
-            for_production=for_production,
-            current_packages=current_packages,
-            verbose=verbose,
-            pool=pool,
-        )
+    with multiprocessing.Pool(processes=jobs) as pool:
+        if not spellcheck_only:
+            run_docs_build_in_parallel(
+                all_build_errors=all_build_errors,
+                for_production=for_production,
+                current_packages=current_packages,
+                verbose=verbose,
+                pool=pool,
+            )
+        if not docs_only:
+            run_spell_check_in_parallel(
+                all_spelling_errors=all_spelling_errors,
+                for_production=for_production,
+                current_packages=current_packages,
+                verbose=verbose,
+                pool=pool,
+            )
 
 
 def print_build_output(result: BuildDocsResult):