mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
serialize black invocations
On a Linux machine here, the tests consistently fail when two copies of black are run at once: % bazel test //qt:format_check //pylib:format_check --cache_test_results=no ==================== Test output for //qt:format_check: Process SyncManager-1: Traceback (most recent call last): File "/home/dae/.cache/bazel/_bazel_dae/fc22e40cbbf8b7d16ac57a00991b1ef1/external/python/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/home/dae/.cache/bazel/_bazel_dae/fc22e40cbbf8b7d16ac57a00991b1ef1/external/python/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/dae/.cache/bazel/_bazel_dae/fc22e40cbbf8b7d16ac57a00991b1ef1/external/python/lib/python3.9/multiprocessing/managers.py", line 583, in _run_server server = cls._Server(registry, address, authkey, serializer) File "/home/dae/.cache/bazel/_bazel_dae/fc22e40cbbf8b7d16ac57a00991b1ef1/external/python/lib/python3.9/multiprocessing/managers.py", line 156, in __init__ self.listener = Listener(address=address, backlog=16) File "/home/dae/.cache/bazel/_bazel_dae/fc22e40cbbf8b7d16ac57a00991b1ef1/external/python/lib/python3.9/multiprocessing/connection.py", line 453, in __init__ self._listener = SocketListener(address, family, backlog) File "/home/dae/.cache/bazel/_bazel_dae/fc22e40cbbf8b7d16ac57a00991b1ef1/external/python/lib/python3.9/multiprocessing/connection.py", line 596, in __init__ self._socket.bind(address) OSError: [Errno 98] Address already in use I dug briefly into Black's code, but suspect this is actually an issue with the multiprocessing library. Didn't have time to investigate it further; this workaround will do for now. (One day I'll get around to merging those separate scripts into a single one. One day. :-))
This commit is contained in:
parent
02112e68bd
commit
a8939e7938
2 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
# Copyright: Ankitects Pty Ltd and contributors
|
# Copyright: Ankitects Pty Ltd and contributors
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import fcntl
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -10,6 +11,10 @@ if __name__ == "__main__":
|
||||||
isort_ini = os.path.abspath(isort_ini)
|
isort_ini = os.path.abspath(isort_ini)
|
||||||
fix = len(sys.argv) > 2
|
fix = len(sys.argv) > 2
|
||||||
|
|
||||||
|
if sys.platform == "linux":
|
||||||
|
file = open("/tmp/anki-black", "w")
|
||||||
|
fcntl.lockf(file, fcntl.LOCK_EX)
|
||||||
|
|
||||||
if fix:
|
if fix:
|
||||||
os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "pylib"))
|
os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "pylib"))
|
||||||
args = []
|
args = []
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright: Ankitects Pty Ltd and contributors
|
# Copyright: Ankitects Pty Ltd and contributors
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import fcntl
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -10,6 +11,10 @@ if __name__ == "__main__":
|
||||||
isort_ini = os.path.abspath(isort_ini)
|
isort_ini = os.path.abspath(isort_ini)
|
||||||
fix = len(sys.argv) > 2
|
fix = len(sys.argv) > 2
|
||||||
|
|
||||||
|
if sys.platform == "linux":
|
||||||
|
file = open("/tmp/anki-black", "w")
|
||||||
|
fcntl.lockf(file, fcntl.LOCK_EX)
|
||||||
|
|
||||||
if fix:
|
if fix:
|
||||||
os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "qt"))
|
os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "qt"))
|
||||||
args = []
|
args = []
|
||||||
|
|
Loading…
Reference in a new issue