Reputation: 629
I have a notebook in databricks that I put into a job to run every day at specific time, and I've also created dashboard from this notebook, how can I have the dashboard results exported automatically every time the job runs? I'm aware of the Jobs API, but I can't figure out the right command to do this. Right now I'm using the python package databricks-api (https://pypi.org/project/databricks-api/) to connect to databricks. My ultimate goal is to automate the process of running the notebook, create dashboard, and then save the results.
Upvotes: 4
Views: 2531
Reputation: 2587
Did you figure it out? I have the same question. This won't be the full answer, but to export just the notebook use the API as demonstrated at at these two links:
This curl command will export a notebook as HTML. What it doesn't do is clearly present the dashboard cleanly, without code, as is so easily done via the Databricks UI:
curl -n -H "Content-Type: application/json" -X GET -d @- https://<mysite>.cloud.databricks.com/api/2.0/workspace/export <<JSON
{
"path": "/Users/[email protected]/notebook_001",
"format": "HTML"
}
JSON
or to download an html file manually:
curl -n -o example.html "https://<yoursite>.cloud.databricks.com/api/2.0/workspace/export?format=HTML&direct_download=true&path=/Users/[email protected]/notebookname_001"
You're probably well beyond this, but it assumes a .netrc and token per this article.
[I would be happy to have edits showing how this process could be changed to export the HTML without code, or better yet in the dashboard view. I too have been over the Jobs API and do not see how it's relevant to an already-run notebook which does not require an online cluster to view the dashboard.]
Upvotes: 0