Skip to content

Commit 6588a32

Browse files
sander-goossusodapop
authored andcommitted
Add Cancel operation
Adds `CancelCommand` operation to proto, server and python client. Added unit tests and with manual testing. Author: Sander Goos <sander.goos@databricks.com>
1 parent 1bedba8 commit 6588a32

File tree

4 files changed

+163
-17
lines changed

4 files changed

+163
-17
lines changed

cmdexec/clients/python/src/databricks/sql/api/messages_pb2.py

Lines changed: 88 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmdexec/clients/python/src/databricks/sql/api/sql_cmd_service_pb2.py

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmdexec/clients/python/src/databricks/sql/api/sql_cmd_service_pb2_grpc.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ def __init__(self, channel):
5858
response_deserializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.
5959
FetchCommandResultsResponse.FromString,
6060
)
61+
self.CancelCommand = channel.unary_unary(
62+
'/databricks.sql.SqlCommandService/CancelCommand',
63+
request_serializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.CancelCommandRequest.
64+
SerializeToString,
65+
response_deserializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.CancelCommandResponse.
66+
FromString,
67+
)
6168
self.CloseCommand = channel.unary_unary(
6269
'/databricks.sql.SqlCommandService/CloseCommand',
6370
request_serializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.CloseCommandRequest.
@@ -124,6 +131,13 @@ def FetchCommandResults(self, request, context):
124131
context.set_details('Method not implemented!')
125132
raise NotImplementedError('Method not implemented!')
126133

134+
def CancelCommand(self, request, context):
135+
"""Cancels the requested command
136+
"""
137+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
138+
context.set_details('Method not implemented!')
139+
raise NotImplementedError('Method not implemented!')
140+
127141
def CloseCommand(self, request, context):
128142
"""Closes the requested command, cancels active commands, and frees associated resources
129143
"""
@@ -176,6 +190,13 @@ def add_SqlCommandServiceServicer_to_server(servicer, server):
176190
response_serializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.
177191
FetchCommandResultsResponse.SerializeToString,
178192
),
193+
'CancelCommand': grpc.unary_unary_rpc_method_handler(
194+
servicer.CancelCommand,
195+
request_deserializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.CancelCommandRequest.
196+
FromString,
197+
response_serializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.CancelCommandResponse.
198+
SerializeToString,
199+
),
179200
'CloseCommand': grpc.unary_unary_rpc_method_handler(
180201
servicer.CloseCommand,
181202
request_deserializer=cmdexec_dot_api_dot_proto_dot_messages__pb2.CloseCommandRequest.
@@ -303,6 +324,24 @@ def FetchCommandResults(request,
303324
options, channel_credentials, insecure, call_credentials, compression, wait_for_ready,
304325
timeout, metadata)
305326

327+
@staticmethod
328+
def CancelCommand(request,
329+
target,
330+
options=(),
331+
channel_credentials=None,
332+
call_credentials=None,
333+
insecure=False,
334+
compression=None,
335+
wait_for_ready=None,
336+
timeout=None,
337+
metadata=None):
338+
return grpc.experimental.unary_unary(
339+
request, target, '/databricks.sql.SqlCommandService/CancelCommand',
340+
cmdexec_dot_api_dot_proto_dot_messages__pb2.CancelCommandRequest.SerializeToString,
341+
cmdexec_dot_api_dot_proto_dot_messages__pb2.CancelCommandResponse.FromString, options,
342+
channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout,
343+
metadata)
344+
306345
@staticmethod
307346
def CloseCommand(request,
308347
target,

0 commit comments

Comments
 (0)