Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef5836b

Browse files
acquire lock before notif + formatting (black)
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parentb57c3f3 commitef5836b

File tree

4 files changed

+63
-14
lines changed

4 files changed

+63
-14
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ def _worker_loop(self):
278278
ifnotlinks_downloaded:
279279
self._shutdown_event.set()
280280
logger.debug("LinkFetcher[%s]: worker thread exiting",self._statement_id)
281-
self._link_data_update.notify_all()
281+
withself._link_data_update:
282+
self._link_data_update.notify_all()
282283

283284
defstart(self):
284285
"""Spawn the worker thread."""

‎tests/unit/test_client.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ 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,mock_results_response,mock_thrift_backend,session_id_hex=Mock()
227+
mock_connection,
228+
mock_results_response,
229+
mock_thrift_backend,
230+
session_id_hex=Mock(),
228231
)
229232
result_set.results=mock_results
230233

@@ -272,7 +275,9 @@ def test_negative_fetch_throws_exception(self):
272275
mock_backend=Mock()
273276
mock_backend.fetch_results.return_value= (Mock(),False,0)
274277

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

277282
withself.assertRaises(ValueError)ase:
278283
result_set.fetchmany(-1)

‎tests/unit/test_downloader.py‎

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

3338
withself.assertRaises(Error)ascontext:
@@ -43,7 +48,12 @@ def test_run_link_past_expiry_buffer(self, mock_time):
4348
# Within the expiry buffer time
4449
result_link.expiryTime=1004
4550
d=downloader.ResultSetDownloadHandler(
46-
settings,result_link,ssl_options=SSLOptions(),chunk_id=0,session_id_hex=Mock(),statement_id=Mock()
51+
settings,
52+
result_link,
53+
ssl_options=SSLOptions(),
54+
chunk_id=0,
55+
session_id_hex=Mock(),
56+
statement_id=Mock(),
4757
)
4858

4959
withself.assertRaises(Error)ascontext:
@@ -63,7 +73,12 @@ def test_run_get_response_not_ok(self, mock_time, mock_session):
6373
result_link=Mock(expiryTime=1001)
6474

6575
d=downloader.ResultSetDownloadHandler(
66-
settings,result_link,ssl_options=SSLOptions(),chunk_id=0,session_id_hex=Mock(),statement_id=Mock()
76+
settings,
77+
result_link,
78+
ssl_options=SSLOptions(),
79+
chunk_id=0,
80+
session_id_hex=Mock(),
81+
statement_id=Mock(),
6782
)
6883
withself.assertRaises(requests.exceptions.HTTPError)ascontext:
6984
d.run()
@@ -82,7 +97,12 @@ def test_run_uncompressed_successful(self, mock_time, mock_session):
8297
result_link=Mock(bytesNum=100,expiryTime=1001)
8398

8499
d=downloader.ResultSetDownloadHandler(
85-
settings,result_link,ssl_options=SSLOptions(),chunk_id=0,session_id_hex=Mock(),statement_id=Mock()
100+
settings,
101+
result_link,
102+
ssl_options=SSLOptions(),
103+
chunk_id=0,
104+
session_id_hex=Mock(),
105+
statement_id=Mock(),
86106
)
87107
file=d.run()
88108

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

107127
d=downloader.ResultSetDownloadHandler(
108-
settings,result_link,ssl_options=SSLOptions(),chunk_id=0,session_id_hex=Mock(),statement_id=Mock()
128+
settings,
129+
result_link,
130+
ssl_options=SSLOptions(),
131+
chunk_id=0,
132+
session_id_hex=Mock(),
133+
statement_id=Mock(),
109134
)
110135
file=d.run()
111136

@@ -121,7 +146,12 @@ def test_download_connection_error(self, mock_time, mock_session):
121146
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'
122147

123148
d=downloader.ResultSetDownloadHandler(
124-
settings,result_link,ssl_options=SSLOptions(),chunk_id=0,session_id_hex=Mock(),statement_id=Mock()
149+
settings,
150+
result_link,
151+
ssl_options=SSLOptions(),
152+
chunk_id=0,
153+
session_id_hex=Mock(),
154+
statement_id=Mock(),
125155
)
126156
withself.assertRaises(ConnectionError):
127157
d.run()
@@ -136,7 +166,12 @@ def test_download_timeout(self, mock_time, mock_session):
136166
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'
137167

138168
d=downloader.ResultSetDownloadHandler(
139-
settings,result_link,ssl_options=SSLOptions(),chunk_id=0,session_id_hex=Mock(),statement_id=Mock()
169+
settings,
170+
result_link,
171+
ssl_options=SSLOptions(),
172+
chunk_id=0,
173+
session_id_hex=Mock(),
174+
statement_id=Mock(),
140175
)
141176
withself.assertRaises(TimeoutError):
142177
d.run()

‎tests/unit/test_thrift_backend.py‎

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

736738
self.assertEqual(display_message,str(cm.exception))
737739
self.assertIn(diagnostic_info,str(cm.exception.message_with_context()))
@@ -772,7 +774,9 @@ def test_direct_results_uses_display_message_if_available(self, tcli_service_cla
772774
ssl_options=SSLOptions(),
773775
)
774776
withself.assertRaises(DatabaseError)ascm:
775-
thrift_backend.execute_command(Mock(),Mock(),100,100,Mock(),Mock(),Mock())
777+
thrift_backend.execute_command(
778+
Mock(),Mock(),100,100,Mock(),Mock(),Mock()
779+
)
776780

777781
self.assertEqual(display_message,str(cm.exception))
778782
self.assertIn(diagnostic_info,str(cm.exception.message_with_context()))
@@ -1450,7 +1454,9 @@ def test_non_arrow_non_column_based_set_triggers_exception(
14501454
thrift_backend=self._make_fake_thrift_backend()
14511455

14521456
withself.assertRaises(OperationalError)ascm:
1453-
thrift_backend.execute_command("foo",Mock(),100,100,Mock(),Mock(),Mock())
1457+
thrift_backend.execute_command(
1458+
"foo",Mock(),100,100,Mock(),Mock(),Mock()
1459+
)
14541460
self.assertIn(
14551461
"Expected results to be in Arrow or column based format",str(cm.exception)
14561462
)
@@ -2279,7 +2285,9 @@ def test_execute_command_sets_complex_type_fields_correctly(
22792285
ssl_options=SSLOptions(),
22802286
**complex_arg_types,
22812287
)
2282-
thrift_backend.execute_command(Mock(),Mock(),100,100,Mock(),Mock(),Mock())
2288+
thrift_backend.execute_command(
2289+
Mock(),Mock(),100,100,Mock(),Mock(),Mock()
2290+
)
22832291
t_execute_statement_req=tcli_service_instance.ExecuteStatement.call_args[
22842292
0
22852293
][0]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp