Skip to content

Commit f5dec9c

Browse files
authored
[Debugger Plugin]: Add spinners for the debugger page (#792)
The spinners are activated during rendering of the node list and the graph, as well as the TF runtime execution time following the stepping/continuing actions.
1 parent 9b247d2 commit f5dec9c

File tree

3 files changed

+75
-9
lines changed

3 files changed

+75
-9
lines changed

tensorboard/plugins/debugger/tf_debugger_dashboard/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ ts_web_library(
4545
"@org_polymer_paper_input",
4646
"@org_polymer_paper_item",
4747
"@org_polymer_paper_menu",
48+
"@org_polymer_paper_progress",
4849
"@org_polymer_paper_slider",
4950
"@org_polymer_paper_spinner",
5051
"@org_polymer_paper_styles",

tensorboard/plugins/debugger/tf_debugger_dashboard/tf-debugger-dashboard.html

+46-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<link rel="import" href="../paper-input/paper-textarea.html">
2323
<link rel="import" href="../paper-item/paper-item.html">
2424
<link rel="import" href="../paper-menu/paper-menu.html">
25+
<link rel="import" href="../paper-progress/paper-progress.html">
26+
<link rel="import" href="../paper-spinner/paper-spinner-lite.html">
2527
<link rel="import" href="../paper-toast/paper-toast.html">
2628
<link rel="import" href="../polymer/polymer.html">
2729
<link rel="import" href="../tf-backend/tf-backend.html">
@@ -99,7 +101,7 @@ <h2>Continue...</h2>
99101
out-graph-hierarchy="{{graphHierarchy}}"
100102
out-graph="{{graph}}"
101103
out-stats="{{stats}}"
102-
progress="{{_progress}}"
104+
progress="{{_graphProgress}}"
103105
></tf-graph-loader>
104106
</div>
105107
</div>
@@ -124,18 +126,15 @@ <h2>Continue...</h2>
124126
</template>
125127
</paper-menu>
126128
</paper-dropdown-menu>
129+
<paper-spinner-lite class="spinner" id="top-right-spinner"></paper-spinner-lite>
130+
<paper-progress id="top-right-progress-bar" value="0"></paper-progress>
127131
<template is="dom-if" if="[[_isTopRightRuntimeGraphsActive]]">
128-
<div id="graph-header">
129-
<span id="runtime-graph-label">
130-
Runtime Graphs
131-
</span>
132-
</div>
133132
<div id="graph-container">
134133
<tf-graph id="graph"
135134
graph-hierarchy="[[graphHierarchy]]"
136135
basic-graph="[[graph]]"
137136
stats="[[stats]]"
138-
progress="[[_progress]]"
137+
progress="{{_graphProgress}}"
139138
color-by="structure"
140139
color-by-params="{{colorByParams}}"
141140
render-hierarchy="{{_renderHierarchy}}"
@@ -209,6 +208,11 @@ <h2>Continue...</h2>
209208
width: 350px;
210209
display: inline-block;
211210
}
211+
#top-right-progress-bar {
212+
width: 100%;
213+
display: inline-block;
214+
vertical-align: middle;
215+
}
212216
.line-item {
213217
display: block;
214218
padding-top: 5px;
@@ -230,6 +234,11 @@ <h2>Continue...</h2>
230234
min-width: 150px;
231235
border: 1px solid #d4d4d4;
232236
}
237+
.spinner {
238+
width: 20px;
239+
height: 20px;
240+
vertical-align: middle;
241+
}
233242
.node-entries {
234243
height: 66%;
235244
overflow: auto;
@@ -390,6 +399,10 @@ <h2>Continue...</h2>
390399
value: -1,
391400
},
392401

402+
_graphProgress: {
403+
type: Object,
404+
},
405+
393406
_requestManager: {
394407
type: Object,
395408
value: () => new tf_backend.RequestManager(50),
@@ -398,6 +411,7 @@ <h2>Continue...</h2>
398411

399412
observers: [
400413
"_onActiveRuntimeGraphDeviceNameChange(_activeRuntimeGraphDeviceName)",
414+
"_graphProgressUpdated(_graphProgress)",
401415
],
402416

403417
ready() {
@@ -484,6 +498,7 @@ <h2>Continue...</h2>
484498

485499
this._maybeUpdateTensorValueViews(
486500
tensorName, responseData['debug_op']);
501+
this._setTopRightSpinnerState(false);
487502
} else {
488503
console.error(
489504
'Invalid long-polling response type: ', responseType);
@@ -733,6 +748,7 @@ <h2>Continue...</h2>
733748
if (this._activeSessionRunKey == null) {
734749
return;
735750
}
751+
this._setTopRightSpinnerState(true);
736752

737753
// First, check to see if any new device GraphDef(s) have arrived and if
738754
// so, retrieve them.
@@ -787,6 +803,7 @@ <h2>Continue...</h2>
787803
this._continueToType = '';
788804
this._continueToTarget = '';
789805
this._continueToCounterTarget = -1;
806+
this._setTopRightSpinnerState(false);
790807
},
791808

792809
_topRightSelectedChanged(topRightSelected) {
@@ -835,6 +852,28 @@ <h2>Continue...</h2>
835852
console.log('Breakpoint set_state response: ', response);
836853
});
837854
},
855+
856+
_graphProgressUpdated(progress) {
857+
const topRightProgressBar = this.$$('#top-right-progress-bar');
858+
if (this._latestSessionRun == null) {
859+
// No Session.run() has connected yet. Do not show the spinner(s) or
860+
// the progress bar(s).
861+
topRightProgressBar.setAttribute('value', 0);
862+
this._setTopRightSpinnerState(false);
863+
} else {
864+
topRightProgressBar.setAttribute('value', progress.value);
865+
this._setTopRightSpinnerState(progress.value < 100);
866+
}
867+
},
868+
869+
_setTopRightSpinnerState(isActive) {
870+
const topRightSpinner = this.$$('#top-right-spinner');
871+
if (isActive) {
872+
topRightSpinner.setAttribute('active', true);
873+
} else {
874+
topRightSpinner.removeAttribute('active');
875+
}
876+
}
838877
});
839878

840879
tf_tensorboard.registerDashboard({

tensorboard/plugins/debugger/tf_debugger_dashboard/tf-op-selector.html

+28-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<link rel="import" href="../paper-dropdown-menu/paper-dropdown-menu.html">
2121
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
2222
<link rel="import" href="../paper-input/paper-input.html">
23+
<link rel="import" href="../paper-spinner/paper-spinner-lite.html">
2324
<link rel="import" href="../polymer/polymer.html">
2425
<link rel="import" href="../tf-imports/lodash.html">
2526

@@ -47,6 +48,12 @@
4748
value="{{_filterInput}}"
4849
></paper-input>
4950
</div>
51+
<paper-spinner-lite
52+
active
53+
class="spinner"
54+
id="loading-spinner"
55+
hidden="[[!_isLoading]]">
56+
</paper-spinner-lite>
5057
<div id="selector-hierarchy">
5158
</div>
5259
<style>
@@ -95,6 +102,12 @@
95102
padding: 10px 0;
96103
}
97104

105+
:host .spinner {
106+
width: 20px;
107+
height: 20px;
108+
vertical-align: middle;
109+
}
110+
98111
:host #filter-mode {
99112
width: 100px;
100113
display: inline-block;
@@ -167,9 +180,14 @@
167180
value: '',
168181
notify: true,
169182
},
183+
184+
_isLoading: {
185+
type: Boolean,
186+
value: false,
187+
},
170188
},
171189
observers: [
172-
"_renderHierarchy(_watchHierarchy, debugWatchChange)",
190+
"_renderHierarchyWithTimeout(_watchHierarchy, debugWatchChange)",
173191
"_handleForceNodeExpansion(forceExpansionNodeName)",
174192
],
175193
_computeWatchHierarchy(debugWatches, debugWatchChange, filterMode, filterInput) {
@@ -218,10 +236,17 @@
218236
}
219237
},
220238

239+
_renderHierarchyWithTimeout(watchHierarchy, debugWatchChange, filterMode, filterInput) {
240+
this._clearSelectorHierarchy();
241+
this.set('_isLoading', true);
242+
setTimeout(() => {
243+
this._renderHierarchy(watchHierarchy, debugWatchChange, filterMode, filterInput);
244+
}, 10);
245+
},
246+
221247
_renderHierarchy(watchHierarchy, debugWatchChange, filterMode, filterInput) {
222248
this.set('_levelName2Container', {});
223249
this.set('_levelName2Node', {});
224-
this._clearSelectorHierarchy();
225250

226251
const dom = this._renderLevel(null, null, watchHierarchy, debugWatchChange);
227252

@@ -255,6 +280,7 @@
255280

256281
// Append the hierarchy to the DOM.
257282
Polymer.dom(this.$$('#selector-hierarchy')).appendChild(dom);
283+
this.set('_isLoading', false);
258284
},
259285

260286
_renderLevel(levelName, parentLevelName, levelObject, debugWatchChange) {

0 commit comments

Comments
 (0)