Created
February 16, 2016 16:56
-
-
Save tpatel/646422ca1196876d20b9 to your computer and use it in GitHub Desktop.
Notify the progress of Databricks Spark notebook computations via web notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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