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

Run dashboard on non-standard port and set dashboard link #25

Merged
merged 9 commits into from
Nov 8, 2023
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
Loading