Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PaulCornellDB opened this issue Jul 20, 2023 · 0 comments
Open

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

PaulCornellDB opened this issue Jul 20, 2023 · 0 comments

Comments

@PaulCornellDB
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant