Skip to content

Getting client settings, such as host or account_id, is ugly #18

Open
@PaulCornellDB

Description

@PaulCornellDB

If I want to get the host URL for a workspace, I have to do some error-prone string manipulation, for example (see the lines between START HERE and END HERE):

require(databricks)

client <- DatabricksClient()

response <- clustersCreate(
  client = client,
  cluster_name = "my-cluster",
  spark_version = "12.2.x-scala2.12",
  node_type_id = "i3.xlarge",
  autotermination_minutes = 15,
  num_workers = 1
)

# ##########
# START HERE
# ##########
# Get the workspace URL to be used in the following results message.
get_client_debug <- strsplit(client$debug_string(), split = "host=")
get_host <- strsplit(get_client_debug[[1]][2], split = ",")
host <- get_host[[1]][1]

# Make sure the workspace URL ends with a forward slash.
if (endsWith(host, "/")) {
} else {
  host <- paste(host, "/", sep = "")
}
# ########
# END HERE
# ########

print(paste(
  "View the cluster at ",
  host,
  "#setting/clusters/",
  response$cluster_id,
  "/configuration",
  sep = "")
)

Ideally, I'd like to see something more along the lines of this (see the line that ends with # <-- DO THIS INSTEAD):

require(databricks)

client <- DatabricksClient()

response <- clustersCreate(
  client = client,
  cluster_name = "my-cluster",
  spark_version = "12.2.x-scala2.12",
  node_type_id = "i3.xlarge",
  autotermination_minutes = 15,
  num_workers = 1
)

print(paste(
  "View the cluster at ",
  client$host, # <-- DO THIS INSTEAD
  "#setting/clusters/",
  response$cluster_id,
  "/configuration",
  sep = "")
)

Also, similar to the other Databricks SDKs, I'd like to be to able to get other client settings, such as:

  • client$account_id
  • client$auth_type
  • client$azure_* (multiple settings)
  • client$client_* (multiple settings)
  • client$config_file
  • client$debug_headers
  • client$debug_truncate_bytes
  • client$google_* (multiple settings)
  • client$host
  • client$http_timeout_seconds
  • client$password
  • client$profile
  • client$rate_limit
  • client$retry_timeout_seconds
  • client$token
  • client$username

There be might be a few more that I missed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions