databricks-demos / dbdemos

Demos to implement your Databricks Lakehouse
Other
255 stars 80 forks source link

demo feature-store problem #115

Open conradtan opened 2 months ago

conradtan commented 2 months ago

Error when running dbdemos.install('feature-store') or dbdemos.install('feature-store', catalog='databrickstest_catalog_devqa', schema = 'dbdemos')

Throws the below error:

JSONDecodeError Traceback (most recent call last) File /databricks/python/lib/python3.9/site-packages/requests/models.py:910, in Response.json(self, kwargs) 909 try: --> 910 return complexjson.loads(self.text, kwargs) 911 except JSONDecodeError as e: 912 # Catch JSON-related errors and raise as requests.JSONDecodeError 913 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File /databricks/python/lib/python3.9/site-packages/simplejson/init.py:525, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw) 521 if (cls is None and encoding is None and object_hook is None and 522 parse_int is None and parse_float is None and 523 parse_constant is None and object_pairs_hook is None 524 and not use_decimal and not kw): --> 525 return _default_decoder.decode(s) 526 if cls is None:

File /databricks/python/lib/python3.9/site-packages/simplejson/decoder.py:370, in JSONDecoder.decode(self, s, _w, _PY3) 369 s = str(s, self.encoding) --> 370 obj, end = self.raw_decode(s) 371 end = _w(s, end).end()

File /databricks/python/lib/python3.9/site-packages/simplejson/decoder.py:400, in JSONDecoder.raw_decode(self, s, idx, _w, _PY3) 399 idx += 3 --> 400 return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError Traceback (most recent call last) File :2 1 import dbdemos ----> 2 dbdemos.install('feature-store', catalog='databrickstest_catalog_devqa', schema = 'dbdemos')

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/dbdemos.py:242, in install(demo_name, path, overwrite, username, pat_token, workspace_url, skip_dashboards, cloud, start_cluster, use_current_cluster, current_cluster_id, install_dashboard_sequentially, debug, catalog, schema) 239 if not installer.test_premium_pricing(): 240 #Force dashboard skip as dbsql isn't available to avoid any error. 241 skip_dashboards = True --> 242 installer.install_demo(demo_name, path, overwrite, skip_dashboards = skip_dashboards, start_cluster = start_cluster, use_current_cluster = use_current_cluster, debug = debug, catalog = catalog, schema = schema)

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/installer.py:218, in Installer.install_demo(self, demo_name, install_path, overwrite, update_cluster_if_exists, skip_dashboards, start_cluster, use_current_cluster, debug, catalog, schema) 216 use_cluster_id = self.current_cluster_id if use_current_cluster else None 217 try: --> 218 cluster_id, cluster_name = self.load_demo_cluster(demo_name, demo_conf, update_cluster_if_exists, start_cluster, use_cluster_id) 219 except ClusterException as e: 220 self.report.display_cluster_creation_error(e, demo_conf)

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/installer.py:591, in Installer.load_demo_cluster(self, demo_name, demo_conf, update_cluster_if_exists, start_cluster, use_cluster_id) 588 del cluster_conf["autoscale"] 589 cluster_conf["num_workers"] = 0 --> 591 existing_cluster = self.find_cluster(cluster_conf["cluster_name"]) 592 if existing_cluster is None: 593 cluster = self.db.post("2.0/clusters/create", json = cluster_conf)

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/installer.py:645, in Installer.find_cluster(self, cluster_name) 644 def find_cluster(self, cluster_name): --> 645 clusters = self.db.get("2.0/clusters/list") 646 if "clusters" in clusters: 647 for c in clusters["clusters"]:

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/conf.py:99, in DBClient.get(self, path, params, print_auth_error) 97 url = self.conf.workspace_url+"/api/"+self.clean_path(path) 98 with requests.get(url, headers = self.conf.headers, params=params, timeout=60) as r: ---> 99 return self.get_json_result(url, r, print_auth_error)

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/conf.py:114, in DBClient.get_json_result(self, url, r, print_auth_error) 112 except Exception as e: 113 print(f"API CALL ERROR - can't read json. status: {r.status_code} {r.text} - URL: {url} - {e}") --> 114 raise e

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-9e086661-403e-443c-8e7c-83e8bef3bc20/lib/python3.9/site-packages/dbdemos/conf.py:111, in DBClient.get_json_result(self, url, r, print_auth_error) 109 print(f"Unauthorized call. Check your PAT token {r.text} - {r.url} - {url}") 110 try: --> 111 return r.json() 112 except Exception as e: 113 print(f"API CALL ERROR - can't read json. status: {r.status_code} {r.text} - URL: {url} - {e}")

File /databricks/python/lib/python3.9/site-packages/requests/models.py:917, in Response.json(self, **kwargs) 915 raise RequestsJSONDecodeError(e.message) 916 else: --> 917 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: [Errno Expecting value] <!doctype html>

Databricks - Sign In
: 0
QuentinAmbard commented 2 months ago

hey @conradtan, it looks like you can't list the clusters for some reason. Do you know why?

Can you try to install it with the option use_current_cluster=True? It should prevent all cluster list/creation.

conradtan commented 2 months ago

Still has error when using dbdemos.install('feature-store', use_current_cluster=True) I am using Databricks Enterprise and have workspace admin/unrestricted cluster creation privileges. No issues creating clusters or read/write from unity catalog.


JSONDecodeError Traceback (most recent call last) File /databricks/python/lib/python3.9/site-packages/requests/models.py:910, in Response.json(self, kwargs) 909 try: --> 910 return complexjson.loads(self.text, kwargs) 911 except JSONDecodeError as e: 912 # Catch JSON-related errors and raise as requests.JSONDecodeError 913 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File /databricks/python/lib/python3.9/site-packages/simplejson/init.py:525, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw) 521 if (cls is None and encoding is None and object_hook is None and 522 parse_int is None and parse_float is None and 523 parse_constant is None and object_pairs_hook is None 524 and not use_decimal and not kw): --> 525 return _default_decoder.decode(s) 526 if cls is None:

File /databricks/python/lib/python3.9/site-packages/simplejson/decoder.py:370, in JSONDecoder.decode(self, s, _w, _PY3) 369 s = str(s, self.encoding) --> 370 obj, end = self.raw_decode(s)

QuentinAmbard commented 2 months ago

I wonder if the pat token generation from you cluster could have been blocked by an admin Can you run this in a notebook is it working or throwing an error? dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiToken().get()

conradtan commented 2 months ago

@QuentinAmbard The provided command was able to run successfully as below.

image

However it till has error when using dbdemos.install('feature-store', use_current_cluster=True)