Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Was not able to use edit_cluster #28

Closed
waynezhu-unravel opened this issue May 2, 2022 · 3 comments
Closed

Was not able to use edit_cluster #28

waynezhu-unravel opened this issue May 2, 2022 · 3 comments

Comments

@waynezhu-unravel
Copy link

The snippet:
db.cluster.edit_cluster(cluster_id, spark_version="10.3.x-scala2.12")
Could you share some sample on using this edit_cluster API?


HTTPError Traceback (most recent call last)
~/Library/Python/3.7/lib/python/site-packages/databricks_cli/sdk/api_client.py in perform_query(self, method, path, data, headers, files, version)
137 try:
--> 138 resp.raise_for_status()
139 except requests.exceptions.HTTPError as e:

~/Library/Python/3.7/lib/python/site-packages/requests/models.py in raise_for_status(self)
940 if http_error_msg:
--> 941 raise HTTPError(http_error_msg, response=self)
942

HTTPError: 400 Client Error: Bad Request for url: https://adb-xyz.azuredatabricks.net/api/2.0/clusters/edit

During handling of the above exception, another exception occurred:

HTTPError Traceback (most recent call last)
/var/folders/0q/1yts_p_s4rq_1x984fxlbv600000gp/T/ipykernel_15169/3832242952.py in
1 if name == "main":
----> 2 main()

/var/folders/0q/1yts_p_s4rq_1x984fxlbv600000gp/T/ipykernel_15169/3778288670.py in main()
69 unravel_spark2_cluster_configs,
70 unravel_spark3_cluster_configs,
---> 71 output_directory_path)
72

/var/folders/0q/1yts_p_s4rq_1x984fxlbv600000gp/T/ipykernel_15169/2351089658.py in configureInteractiveClustersWithUnravel(cluster_list, workspace_id2api, workspace_spark_verisons, unravel_spark2_cluster_configs, unravel_spark3_cluster_configs, output_path)
91
92 db.cluster.edit_cluster(cluster_id,
---> 93 spark_version="10.3.x-scala2.12")
94
95
~/Library/Python/3.7/lib/python/site-packages/databricks_cli/sdk/service.py in edit_cluster(self, cluster_id, num_workers, autoscale, cluster_name, spark_version, spark_conf, aws_attributes, node_type_id, driver_node_type_id, ssh_public_keys, custom_tags, cluster_log_conf, spark_env_vars, autotermination_minutes, enable_elastic_disk, cluster_source, instance_pool_id, headers)
365 _data['instance_pool_id'] = instance_pool_id
366 print(_data)
--> 367 return self.client.perform_query('POST', '/clusters/edit', data=_data, headers=headers)
368
369 def get_cluster(self, cluster_id, headers=None):

~/Library/Python/3.7/lib/python/site-packages/databricks_cli/sdk/api_client.py in perform_query(self, method, path, data, headers, files, version)
144 except ValueError:
145 pass
--> 146 raise requests.exceptions.HTTPError(message, response=e.response)
147 return resp.json()
148

HTTPError: 400 Client Error: Bad Request for url: https://adb-xyz.azuredatabricks.net/api/2.0/clusters/edit
Response from server:
{ 'error_code': 'INVALID_PARAMETER_VALUE',
'message': 'Missing required field: Size'}

@crflynn
Copy link
Owner

crflynn commented May 2, 2022

According to the documentation, the required fields are cluster_id, spark_version, and node_type_id, and it appears you are missing the node_type_id in your request.

@crflynn crflynn closed this as completed May 2, 2022
@waynezhu-unravel
Copy link
Author

Thanks. Is edit_cluster restful? i.e. I have to get the whole state in as parameters when editing.

@crflynn
Copy link
Owner

crflynn commented May 4, 2022

I'm not sure how it works. Probably best to ask your databricks rep.

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

No branches or pull requests

2 participants