|
20 | 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
21 | 21 | # See the License for the specific language governing permissions and |
22 | 22 | # limitations under the License. |
23 | | -import sys |
24 | 23 | import time |
25 | 24 | from datetime import datetime |
26 | 25 | from json import loads as json_loads |
@@ -331,41 +330,6 @@ def cluster_events_cli(api_client, cluster_id, start_time, end_time, order, even |
331 | 330 | click.echo(tabulate(_cluster_events_to_table(events_json), tablefmt='plain')) |
332 | 331 |
|
333 | 332 |
|
334 | | -@click.command(context_settings=CONTEXT_SETTINGS) |
335 | | -@click.option('--cluster-id', cls=OneOfOption, one_of=CLUSTER_OPTIONS, |
336 | | - type=ClusterIdClickType(), default=None, help=ClusterIdClickType.help) |
337 | | -@click.option('--cluster-name', cls=OneOfOption, one_of=CLUSTER_OPTIONS, |
338 | | - type=ClusterIdClickType(), default=None, help=ClusterIdClickType.help) |
339 | | -@click.option('--local-port', type=click.INT, |
340 | | - help="The local port to use for the local tunneling server") |
341 | | -@click.option('--debug', '-d', is_flag=True, help="Run the tunnel in debug mode") |
342 | | -@profile_option |
343 | | -@eat_exceptions |
344 | | -@provide_api_client |
345 | | -def tunnel_cli(api_client, cluster_id, cluster_name, local_port, debug): |
346 | | - """ |
347 | | - [Alpha] Start a secure TCP tunnel to a cluster over Databricks' identity proxy. |
348 | | - """ |
349 | | - if sys.version_info < (3, 6): |
350 | | - raise RuntimeError("The tunneling command is not supported on Python version < 3.6") |
351 | | - if not api_client.token: |
352 | | - raise RuntimeError("The tunneling cli only supports personal token authentication.") |
353 | | - |
354 | | - if cluster_id: |
355 | | - pass |
356 | | - elif cluster_name: |
357 | | - cluster = ClusterApi(api_client).get_cluster_by_name(cluster_name) |
358 | | - cluster_id = cluster["cluster_id"] |
359 | | - else: |
360 | | - raise RuntimeError('cluster_name and cluster_id must not be empty!') |
361 | | - |
362 | | - # TODO(tunneling-cli): move this up once we support python3 only |
363 | | - from databricks_cli.tunnel.api import TunnelApi |
364 | | - |
365 | | - click.echo("Starting a secure tunnel to cluster with ID: {}...".format(cluster_id)) |
366 | | - TunnelApi(api_client, cluster_id, debug=debug).start_tunneling(local_port=local_port) |
367 | | - |
368 | | - |
369 | 333 | @click.group(context_settings=CONTEXT_SETTINGS, |
370 | 334 | short_help='Utility to interact with Databricks clusters.') |
371 | 335 | @click.option('--version', '-v', is_flag=True, callback=print_version_callback, |
@@ -393,4 +357,3 @@ def clusters_group(): # pragma: no cover |
393 | 357 | clusters_group.add_command(spark_versions_cli, name='spark-versions') |
394 | 358 | clusters_group.add_command(permanent_delete_cli, name='permanent-delete') |
395 | 359 | clusters_group.add_command(cluster_events_cli, name='events') |
396 | | -clusters_group.add_command(tunnel_cli, name='tunnel') |
0 commit comments