Skip to content

Commit 24332c8

Browse files
Revert "acquire lock before notif + formatting (black)"
This reverts commit ef5836b.
1 parent ef5836b commit 24332c8

File tree

4 files changed

+14
-63
lines changed

4 files changed

+14
-63
lines changed

src/databricks/sql/backend/sea/queue.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ def _worker_loop(self):
278278
if not links_downloaded:
279279
self._shutdown_event.set()
280280
logger.debug("LinkFetcher[%s]: worker thread exiting", self._statement_id)
281-
with self._link_data_update:
282-
self._link_data_update.notify_all()
281+
self._link_data_update.notify_all()
283282

284283
def start(self):
285284
"""Spawn the worker thread."""

tests/unit/test_client.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,7 @@ def test_closing_result_set_hard_closes_commands(self):
224224

225225
mock_thrift_backend.fetch_results.return_value = (Mock(), False, 0)
226226
result_set = ThriftResultSet(
227-
mock_connection,
228-
mock_results_response,
229-
mock_thrift_backend,
230-
session_id_hex=Mock(),
227+
mock_connection, mock_results_response, mock_thrift_backend, session_id_hex=Mock()
231228
)
232229
result_set.results = mock_results
233230

@@ -275,9 +272,7 @@ def test_negative_fetch_throws_exception(self):
275272
mock_backend = Mock()
276273
mock_backend.fetch_results.return_value = (Mock(), False, 0)
277274

278-
result_set = ThriftResultSet(
279-
Mock(), Mock(), mock_backend, session_id_hex=Mock()
280-
)
275+
result_set = ThriftResultSet(Mock(), Mock(), mock_backend, session_id_hex=Mock())
281276

282277
with self.assertRaises(ValueError) as e:
283278
result_set.fetchmany(-1)

tests/unit/test_downloader.py

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ def test_run_link_expired(self, mock_time):
2727
# Already expired
2828
result_link.expiryTime = 999
2929
d = downloader.ResultSetDownloadHandler(
30-
settings,
31-
result_link,
32-
ssl_options=SSLOptions(),
33-
chunk_id=0,
34-
session_id_hex=Mock(),
35-
statement_id=Mock(),
30+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
3631
)
3732

3833
with self.assertRaises(Error) as context:
@@ -48,12 +43,7 @@ def test_run_link_past_expiry_buffer(self, mock_time):
4843
# Within the expiry buffer time
4944
result_link.expiryTime = 1004
5045
d = downloader.ResultSetDownloadHandler(
51-
settings,
52-
result_link,
53-
ssl_options=SSLOptions(),
54-
chunk_id=0,
55-
session_id_hex=Mock(),
56-
statement_id=Mock(),
46+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
5747
)
5848

5949
with self.assertRaises(Error) as context:
@@ -73,12 +63,7 @@ def test_run_get_response_not_ok(self, mock_time, mock_session):
7363
result_link = Mock(expiryTime=1001)
7464

7565
d = downloader.ResultSetDownloadHandler(
76-
settings,
77-
result_link,
78-
ssl_options=SSLOptions(),
79-
chunk_id=0,
80-
session_id_hex=Mock(),
81-
statement_id=Mock(),
66+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
8267
)
8368
with self.assertRaises(requests.exceptions.HTTPError) as context:
8469
d.run()
@@ -97,12 +82,7 @@ def test_run_uncompressed_successful(self, mock_time, mock_session):
9782
result_link = Mock(bytesNum=100, expiryTime=1001)
9883

9984
d = downloader.ResultSetDownloadHandler(
100-
settings,
101-
result_link,
102-
ssl_options=SSLOptions(),
103-
chunk_id=0,
104-
session_id_hex=Mock(),
105-
statement_id=Mock(),
85+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
10686
)
10787
file = d.run()
10888

@@ -125,12 +105,7 @@ def test_run_compressed_successful(self, mock_time, mock_session):
125105
result_link = Mock(bytesNum=100, expiryTime=1001)
126106

127107
d = downloader.ResultSetDownloadHandler(
128-
settings,
129-
result_link,
130-
ssl_options=SSLOptions(),
131-
chunk_id=0,
132-
session_id_hex=Mock(),
133-
statement_id=Mock(),
108+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
134109
)
135110
file = d.run()
136111

@@ -146,12 +121,7 @@ def test_download_connection_error(self, mock_time, mock_session):
146121
mock_session.return_value.get.return_value.content = b'\x04"M\x18h@d\x00\x00\x00\x00\x00\x00\x00#\x14\x00\x00\x00\xaf1234567890\n\x00BP67890\x00\x00\x00\x00'
147122

148123
d = downloader.ResultSetDownloadHandler(
149-
settings,
150-
result_link,
151-
ssl_options=SSLOptions(),
152-
chunk_id=0,
153-
session_id_hex=Mock(),
154-
statement_id=Mock(),
124+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
155125
)
156126
with self.assertRaises(ConnectionError):
157127
d.run()
@@ -166,12 +136,7 @@ def test_download_timeout(self, mock_time, mock_session):
166136
mock_session.return_value.get.return_value.content = b'\x04"M\x18h@d\x00\x00\x00\x00\x00\x00\x00#\x14\x00\x00\x00\xaf1234567890\n\x00BP67890\x00\x00\x00\x00'
167137

168138
d = downloader.ResultSetDownloadHandler(
169-
settings,
170-
result_link,
171-
ssl_options=SSLOptions(),
172-
chunk_id=0,
173-
session_id_hex=Mock(),
174-
statement_id=Mock(),
139+
settings, result_link, ssl_options=SSLOptions(), chunk_id=0, session_id_hex=Mock(), statement_id=Mock()
175140
)
176141
with self.assertRaises(TimeoutError):
177142
d.run()

tests/unit/test_thrift_backend.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,7 @@ def test_get_status_uses_display_message_if_available(self, tcli_service_class):
731731
ssl_options=SSLOptions(),
732732
)
733733
with self.assertRaises(DatabaseError) as cm:
734-
thrift_backend.execute_command(
735-
Mock(), Mock(), 100, 100, Mock(), Mock(), Mock()
736-
)
734+
thrift_backend.execute_command(Mock(), Mock(), 100, 100, Mock(), Mock(), Mock())
737735

738736
self.assertEqual(display_message, str(cm.exception))
739737
self.assertIn(diagnostic_info, str(cm.exception.message_with_context()))
@@ -774,9 +772,7 @@ def test_direct_results_uses_display_message_if_available(self, tcli_service_cla
774772
ssl_options=SSLOptions(),
775773
)
776774
with self.assertRaises(DatabaseError) as cm:
777-
thrift_backend.execute_command(
778-
Mock(), Mock(), 100, 100, Mock(), Mock(), Mock()
779-
)
775+
thrift_backend.execute_command(Mock(), Mock(), 100, 100, Mock(), Mock(), Mock())
780776

781777
self.assertEqual(display_message, str(cm.exception))
782778
self.assertIn(diagnostic_info, str(cm.exception.message_with_context()))
@@ -1454,9 +1450,7 @@ def test_non_arrow_non_column_based_set_triggers_exception(
14541450
thrift_backend = self._make_fake_thrift_backend()
14551451

14561452
with self.assertRaises(OperationalError) as cm:
1457-
thrift_backend.execute_command(
1458-
"foo", Mock(), 100, 100, Mock(), Mock(), Mock()
1459-
)
1453+
thrift_backend.execute_command("foo", Mock(), 100, 100, Mock(), Mock(), Mock())
14601454
self.assertIn(
14611455
"Expected results to be in Arrow or column based format", str(cm.exception)
14621456
)
@@ -2285,9 +2279,7 @@ def test_execute_command_sets_complex_type_fields_correctly(
22852279
ssl_options=SSLOptions(),
22862280
**complex_arg_types,
22872281
)
2288-
thrift_backend.execute_command(
2289-
Mock(), Mock(), 100, 100, Mock(), Mock(), Mock()
2290-
)
2282+
thrift_backend.execute_command(Mock(), Mock(), 100, 100, Mock(), Mock(), Mock())
22912283
t_execute_statement_req = tcli_service_instance.ExecuteStatement.call_args[
22922284
0
22932285
][0]

0 commit comments

Comments
 (0)