Skip to content

Commit

Permalink
Run dashboard on non-standard port and set dashboard link (#25)
Browse files Browse the repository at this point in the history
* Run dashboard on Ray port and set Dashboard link

* Remove _version.py

* Start dashboard on a few ports for experimentation

* Make property

* Avoid Ray port and just use 8087

* Find spark session

* Remove / from dashboard prefix

* Trying to set a null prefix a little differently

* Revert prefix changes
  • Loading branch information
jacobtomlinson authored Nov 8, 2023
1 parent 3162adb commit 371e2f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dask_databricks/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run():

if DB_IS_DRIVER == "TRUE":
log.info("This node is the Dask scheduler.")
subprocess.Popen(["dask", "scheduler"])
subprocess.Popen(["dask", "scheduler", "--dashboard-address", ":8787,:8087"])
else:
log.info("This node is a Dask worker.")
log.info(f"Connecting to Dask scheduler at {DB_DRIVER_IP}:8786")
Expand Down
14 changes: 12 additions & 2 deletions dask_databricks/databrickscluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
from distributed.deploy.cluster import Cluster
from tornado.ioloop import IOLoop

# Databricks Notebooks injects the `spark` session variable
if "spark" not in globals():
# Databricks Notebooks injects the `spark` session variable but we need to create it ourselves
try:
from pyspark.sql import SparkSession

spark = SparkSession.getActiveSession()
except ImportError:
spark = None


Expand Down Expand Up @@ -39,6 +43,12 @@ async def _start(self):
self.scheduler_comm = rpc(f"{self.spark_local_ip}:8786")
await super()._start()

@property
def dashboard_link(self):
cluster_id = spark.conf.get("spark.databricks.clusterUsageTags.clusterId")
org_id = spark.conf.get("spark.databricks.clusterUsageTags.orgId")
return f"https://dbc-dp-{org_id}.cloud.databricks.com/driver-proxy/o/{org_id}/{cluster_id}/8087/status"


def get_client():
"""Get a Dask client connected to a Databricks cluster."""
Expand Down

0 comments on commit 371e2f6

Please sign in to comment.