Skip to content

Instantly share code, notes, and snippets.

@tpatel
Created February 16, 2016 16:56
Show Gist options
  • Select an option

  • Save tpatel/646422ca1196876d20b9 to your computer and use it in GitHub Desktop.

Select an option

Save tpatel/646422ca1196876d20b9 to your computer and use it in GitHub Desktop.
Notify the progress of Databricks Spark notebook computations via web notifications
(function() {
if(!("Notification" in window)) {
return;
}
function notify(str) {
if (Notification.permission === "granted") {
new Notification(str);
}
}
if (Notification.permission !== "granted"
&& Notification.permission !== "denied") {
Notification.requestPermission();
}
var prevRunning = 0;
function check() {
var running = document.querySelectorAll('.progress-bar-shadow').length;
if(running < prevRunning && running == 0) {
notify("Spark notebook: All computations are done.");
} else if(running < prevRunning) {
notify("Spark notebook: " + running + " computations left.");
}
prevRunning = running;
}
setInterval(check, 10e3);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment