Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PostCommit_Python_Versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"revision": 1
}
8 changes: 7 additions & 1 deletion sdks/python/apache_beam/transforms/external_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,13 @@ def test_implicit_builder_with_constructor_method(self):

class JavaJarExpansionServiceTest(unittest.TestCase):
def setUp(self):
SubprocessServer._cache._live_owners = set()
# Temporarily override _live_owners with an empty set for this test,
# preventing contamination of the process-wide global cache and avoiding
# side effects on other tests.
patcher = mock.patch.object(
SubprocessServer._cache, '_live_owners', new=set())
patcher.start()
self.addCleanup(patcher.stop)
Comment thread
shunping marked this conversation as resolved.

def test_classpath(self):
with tempfile.TemporaryDirectory() as temp_dir:
Expand Down
11 changes: 6 additions & 5 deletions sdks/python/apache_beam/utils/subprocess_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ def __init__(self, constructor, destructor):
self._counter = 0

def _next_id(self):
with self._lock:
self._counter += 1
return self._counter
# Caller must hold self._lock.
self._counter += 1
return self._counter
Comment thread
shunping marked this conversation as resolved.

def register(self):
owner = self._next_id()
self._live_owners.add(owner)
with self._lock:
owner = self._next_id()
self._live_owners.add(owner)
return owner

def purge(self, owner):
Expand Down
Loading