Exemplo n.º 1
0
from databricks_cli.utils import eat_exceptions, CONTEXT_SETTINGS, pretty_format, json_cli_base, \
    truncate_string
from databricks_cli.configure.config import provide_api_client, profile_option, debug_option
from databricks_cli.version import print_version_callback, version


@click.command(context_settings=CONTEXT_SETTINGS)
@click.option(
    '--json-file',
    default=None,
    type=click.Path(),
    help='File containing JSON request to POST to /api/2.0/jobs/create.')
@click.option('--json',
              default=None,
              type=JsonClickType(),
              help=JsonClickType.help('/api/2.0/jobs/create'))
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def create_cli(api_client, json_file, json):
    """
    Creates a job.

    The specification for the json option can be found
    https://docs.databricks.com/api/latest/jobs.html#create
    """
    json_cli_base(json_file, json,
                  lambda json: JobsApi(api_client).create_job(json))

Exemplo n.º 2
0
from databricks_cli.utils import eat_exceptions, CONTEXT_SETTINGS, pretty_format, json_cli_base, \
    truncate_string
from databricks_cli.configure.config import require_config
from databricks_cli.version import print_version_callback, version


@click.command(context_settings=CONTEXT_SETTINGS)
@click.option(
    '--json-file',
    default=None,
    type=click.Path(),
    help='File containing JSON request to POST to /api/2.0/clusters/create.')
@click.option('--json',
              default=None,
              type=JsonClickType(),
              help=JsonClickType.help('/api/2.0/clusters/create'))
@require_config
@eat_exceptions
def create_cli(json_file, json):
    """
    Creates a Databricks cluster.

    The specification for the request json can be found at
    https://docs.databricks.com/api/latest/clusters.html#create
    """
    json_cli_base(json_file, json, create_cluster)


@click.command(
    context_settings=CONTEXT_SETTINGS,
    short_help='Starts a terminated Databricks cluster given its ID.')
Exemplo n.º 3
0
import click
from tabulate import tabulate

from databricks_cli.click_types import OutputClickType, JsonClickType, InstancePoolIdClickType
from databricks_cli.instance_pools.api import InstancePoolsApi
from databricks_cli.utils import eat_exceptions, CONTEXT_SETTINGS, pretty_format, json_cli_base, \
    truncate_string
from databricks_cli.configure.config import provide_api_client, profile_option, debug_option
from databricks_cli.version import print_version_callback, version


@click.command(context_settings=CONTEXT_SETTINGS)
@click.option('--json-file', default=None, type=click.Path(),
              help='File containing JSON request to POST to /api/2.0/instance-pools/create.')
@click.option('--json', default=None, type=JsonClickType(),
              help=JsonClickType.help('/api/2.0/instance-pools/create'))
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def create_cli(api_client, json_file, json):
    """
    Creates a Databricks instance pool.

    The specification for the request json can be found at
    https://docs.databricks.com/api/latest/instance-pools.html#create
    """
    json_cli_base(json_file, json,
                  lambda json: InstancePoolsApi(api_client).create_instance_pool(json))

Exemplo n.º 4
0
    truncate_string
from databricks_cli.configure.config import provide_api_client, profile_option, debug_option
from databricks_cli.runs.api import RunsApi
from databricks_cli.version import print_version_callback, version


@click.command(context_settings=CONTEXT_SETTINGS)
@click.option(
    '--json-file',
    default=None,
    type=click.Path(),
    help='File containing JSON request to POST to /api/2.0/jobs/runs/submit.')
@click.option('--json',
              default=None,
              type=JsonClickType(),
              help=JsonClickType.help('/api/2.0/jobs/runs/submit'))
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def submit_cli(api_client, json_file, json):
    """
    Submits a one-time run.

    The specification for the request json can be found
    https://docs.databricks.com/api/latest/jobs.html#runs-submit
    """
    json_cli_base(json_file, json,
                  lambda json: RunsApi(api_client).submit_run(json))

Exemplo n.º 5
0
from databricks_cli.configure.config import provide_api_client, profile_option, debug_option
from databricks_cli.version import print_version_callback, version


@click.command(context_settings=CONTEXT_SETTINGS)
@click.option(
    '--json-file',
    default=None,
    type=click.Path(),
    help=
    'File containing JSON request to POST to /api/2.0/policies/clusters/create.'
)
@click.option('--json',
              default=None,
              type=JsonClickType(),
              help=JsonClickType.help('/api/2.0/policies/clusters/create'))
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def create_cli(api_client, json_file, json):
    """
    Creates a Databricks cluster Policy.

    The specification for the request json can be found at
    https://docs.databricks.com/dev-tools/api/latest/policies.html#create
    """
    json_cli_base(
        json_file, json,
        lambda json: ClusterPolicyApi(api_client).create_cluster_policy(json))