summaryrefslogtreecommitdiff
path: root/buildscripts/linter
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@mongodb.com>2022-04-24 01:22:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-24 02:12:33 +0000
commita3a87f936f4f10ddd82be28e4e49fbb22bdf3b08 (patch)
treef55c0b997bb5f7400b3f96c7969bb0e4e64e8e6a /buildscripts/linter
parent9563cadc7d74f9739e93f33142fc6ea607ec7d4c (diff)
downloadmongo-a3a87f936f4f10ddd82be28e4e49fbb22bdf3b08.tar.gz
SERVER-65672 upgrade python packages to support 3.10
Diffstat (limited to 'buildscripts/linter')
-rw-r--r--buildscripts/linter/git_base.py2
-rw-r--r--buildscripts/linter/parallel.py25
-rw-r--r--buildscripts/linter/pydocstyle.py2
3 files changed, 13 insertions, 16 deletions
diff --git a/buildscripts/linter/git_base.py b/buildscripts/linter/git_base.py
index f7eaecae95c..f54bc8e87c5 100644
--- a/buildscripts/linter/git_base.py
+++ b/buildscripts/linter/git_base.py
@@ -236,6 +236,7 @@ class GitException(Exception):
process_args: a list containing the git command and arguments (includes 'git' as its first
element) that were run, if any.
stderr: the error output of the git command.
+
"""
def __init__( # pylint: disable=too-many-arguments
@@ -258,6 +259,7 @@ class GitCommandResult(object):
returncode: the return code.
stdout: the output of the command.
stderr: the error output of the command.
+
"""
def __init__( # pylint: disable=too-many-arguments
diff --git a/buildscripts/linter/parallel.py b/buildscripts/linter/parallel.py
index 8c38f6a3294..25a6f0d7e75 100644
--- a/buildscripts/linter/parallel.py
+++ b/buildscripts/linter/parallel.py
@@ -9,7 +9,11 @@ from typing import Any, Callable, List
def parallel_process(items, func):
# type: (List[Any], Callable[[Any], bool]) -> bool
- """Run a set of work items to completion and wait."""
+ """
+ Run a set of work items to completion and wait.
+
+ :returns whether all tasks were successful.
+ """
try:
cpus = cpu_count()
except NotImplementedError:
@@ -17,20 +21,16 @@ def parallel_process(items, func):
task_queue = queue.Queue() # type: queue.Queue
- # Use a list so that worker function will capture this variable
- pp_event = threading.Event()
- pp_result = [True]
- pp_lock = threading.Lock()
+ has_failure_event = threading.Event()
def worker():
# type: () -> None
"""Worker thread to process work items in parallel."""
- while not pp_event.is_set():
+ while True:
try:
item = task_queue.get_nowait()
except queue.Empty:
# if the queue is empty, exit the worker thread
- pp_event.set()
return
try:
@@ -39,13 +39,8 @@ def parallel_process(items, func):
# Tell the queue we finished with the item
task_queue.task_done()
- # Return early if we fail, and signal we are done
if not ret:
- with pp_lock:
- pp_result[0] = False
-
- pp_event.set()
- return
+ has_failure_event.set()
# Enqueue all the work we want to process
for item in items:
@@ -62,10 +57,10 @@ def parallel_process(items, func):
# Wait for the threads to finish
# Loop with a timeout so that we can process Ctrl-C interrupts
- while not pp_event.wait(1):
+ while not queue.Empty:
time.sleep(1)
for thread in threads:
thread.join()
- return pp_result[0]
+ return not has_failure_event.is_set()
diff --git a/buildscripts/linter/pydocstyle.py b/buildscripts/linter/pydocstyle.py
index 8d6b7dde0c7..9e8a74a3857 100644
--- a/buildscripts/linter/pydocstyle.py
+++ b/buildscripts/linter/pydocstyle.py
@@ -11,7 +11,7 @@ class PyDocstyleLinter(base.LinterBase):
def __init__(self):
# type: () -> None
"""Create a pydocstyle linter."""
- super(PyDocstyleLinter, self).__init__("pydocstyle", "2.1.1")
+ super(PyDocstyleLinter, self).__init__("pydocstyle", "6.1.1")
def get_lint_version_cmd_args(self):
# type: () -> List[str]