Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnan-r committed Jul 30, 2017
1 parent 996981a commit 6bd8b10
Show file tree
Hide file tree
Showing 15 changed files with 794 additions and 204 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ extension/build/
extension/node_modules/
extension/sparkmonitor/static/
*.jar
extension/docs/
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
### Quick Install
```bash
pip install https://github.com/krishnan-r/sparkmonitor/releases/download/v0.0.1/sparkmonitor.tar.gz #Use latest version as in github releases
#Frontend
jupyter nbextension install sparkmonitor --py --user --symlink
jupyter nbextension enable sparkmonitor --py --user
#NotebookServer

jupyter nbextension install sparkmonitor --py --user --symlink
jupyter nbextension enable sparkmonitor --py --user
jupyter serverextension enable --py --user sparkmonitor
#Kernel
ipython profile create
echo "c.InteractiveShellApp.extensions.append('sparkmonitor')" >> $(ipython profile locate default)/ipython_kernel_config.py
ipython profile create && echo "c.InteractiveShellApp.extensions.append('sparkmonitor')" >> $(ipython profile locate default)/ipython_kernel_config.py
```
### Details

Expand Down
4 changes: 4 additions & 0 deletions extension/.esdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"source": "./js",
"destination": "../docs/esdoc/"
}
21 changes: 14 additions & 7 deletions extension/js/CellMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ var Timeline = null;
var TaskChart = null;
requirejs(['./timeline'], function (timeline) {
Timeline = timeline;
console.log("SparkMonitor: Timeline module loaded", timeline);
console.log("SparkMonitor: Timeline module loaded", [timeline]);
});
requirejs(['./taskchart'], function (taskchart) {
TaskChart = taskchart;
console.log("SparkMonitor: TaskChart module loaded", taskchart)
console.log("SparkMonitor: TaskChart module loaded", [taskchart])
});

function CellMonitor(monitor, cell) {
var that = this;
window.cm=this;//Debugging


this.monitor = monitor; //Parent SparkMonitor instance
this.cell = cell //Jupyter Cell instance
this.view = "jobs"; //The current display tab
Expand All @@ -38,8 +41,7 @@ function CellMonitor(monitor, cell) {
this.displayCreated = false;
this.displayClosed = false;

this.timeline = new Timeline(this);
this.taskchart = new TaskChart(this);


this.badgeInterval = setInterval($.proxy(this.setBadges, this), 1000);

Expand All @@ -61,6 +63,10 @@ function CellMonitor(monitor, cell) {
this.jobData = {};
this.stageData = {};
this.stageIdtoJobId = {};

this.timeline = new Timeline(this);
this.taskchart = new TaskChart(this);

}

CellMonitor.prototype.createDisplay = function () {
Expand All @@ -86,7 +92,7 @@ CellMonitor.prototype.createDisplay = function () {
that.cleanUp();
});

element.find('.sparkuitabbutton').click(function(){that.openSparkUI('');});
element.find('.sparkuitabbutton').click(function () { that.openSparkUI(''); });
element.find('.titlecollapse').click(function () {
if (that.view != "hidden") {
that.lastview = that.view;
Expand Down Expand Up @@ -136,10 +142,10 @@ CellMonitor.prototype.createDisplay = function () {
}
else console.error("SparkMonitor: Error Display Already Exists");
}
CellMonitor.prototype.openSparkUI = function (url='') {
CellMonitor.prototype.openSparkUI = function (url = '') {
var iframe = $('\
<div style="overflow:hidden">\
<iframe src="'+ Jupyter.notebook.base_url + 'sparkmonitor/'+url+'" frameborder="0" scrolling="yes" class="sparkuiframe">\
<iframe src="'+ Jupyter.notebook.base_url + 'sparkmonitor/' + url + '" frameborder="0" scrolling="yes" class="sparkuiframe">\
</iframe>\
</div>\
');
Expand Down Expand Up @@ -447,6 +453,7 @@ CellMonitor.prototype.sparkJobStart = function (data) {
this.numActiveJobs += 1;
//this.setBadges();
this.badgesmodified = true;
this.appId = data.appId;
var name = $('<div>').text(data.name).html().split(' ')[0];//Escaping HTML <, > from string
//--------------
this.jobData[data.jobId] = {
Expand Down
12 changes: 6 additions & 6 deletions extension/js/SparkMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ SparkMonitor.prototype.sparkJobStart = function (data) {
}
this.totalCores = data.totalCores;
this.numExecutors=data.numExecutors;
if (!cellmonitor.displayClosed)
if (cellmonitor && !cellmonitor.displayClosed)
cellmonitor.sparkJobStart(data);
}

Expand All @@ -120,7 +120,7 @@ SparkMonitor.prototype.sparkJobEnd = function (data) {
var cellid = this.data['app' + this.app + 'job' + data.jobId]['cell_id'];
if (cellid) {
var cellmonitor = this.cellmonitors[cellid]
if (!cellmonitor.displayClosed) cellmonitor.sparkJobEnd(data);
if (cellmonitor && !cellmonitor.displayClosed) cellmonitor.sparkJobEnd(data);

}
else console.error('SparkMonitor:ERROR no cellID for job');
Expand All @@ -139,15 +139,15 @@ SparkMonitor.prototype.sparkStageSubmitted = function (data) {
cell_id: cell.cell_id,
};
var cellmonitor = this.getCellMonitor(cell);
if (!cellmonitor.displayClosed) cellmonitor.sparkStageSubmitted(data);
if (cellmonitor && !cellmonitor.displayClosed) cellmonitor.sparkStageSubmitted(data);
}

SparkMonitor.prototype.sparkStageCompleted = function (data) {
console.log('SparkMonitor:Stage Completed', data);
var cellid = this.data['app' + this.app + 'stage' + data.stageId]['cell_id'];
if (cellid) {
var cellmonitor = this.cellmonitors[cellid]
if (!cellmonitor.displayClosed) cellmonitor.sparkStageCompleted(data);
if (cellmonitor && !cellmonitor.displayClosed) cellmonitor.sparkStageCompleted(data);
}
else console.error('SparkMonitor:ERROR no cellId for completed stage');
}
Expand All @@ -157,7 +157,7 @@ SparkMonitor.prototype.sparkTaskStart = function (data) {
var cellid = this.data['app' + this.app + 'stage' + data.stageId]['cell_id'];
if (cellid) {
var cellmonitor = this.cellmonitors[cellid]
if (!cellmonitor.displayClosed) cellmonitor.sparkTaskStart(data);
if (cellmonitor && !cellmonitor.displayClosed) cellmonitor.sparkTaskStart(data);

}
else console.error('SparkMonitor:ERROR no cellID for task start');
Expand All @@ -167,7 +167,7 @@ SparkMonitor.prototype.sparkTaskEnd = function (data) {
var cellid = this.data['app' + this.app + 'stage' + data.stageId]['cell_id'];
if (cellid) {
var cellmonitor = this.cellmonitors[cellid]
if (!cellmonitor.displayClosed) cellmonitor.sparkTaskEnd(data);
if (cellmonitor && !cellmonitor.displayClosed) cellmonitor.sparkTaskEnd(data);

}
else console.error('SparkMonitor:ERROR no cellID for task end');
Expand Down
Loading

0 comments on commit 6bd8b10

Please sign in to comment.