Skip to content

Commit

Permalink
Surface critical error messages to the UI.
Browse files Browse the repository at this point in the history
- Also choose the first run by default when there are multiple runs.
- Make sure observer gets called in Polymer between run switches.
Change: 137074884
  • Loading branch information
Dan Smilkov authored and tensorflower-gardener committed Oct 24, 2016
1 parent 2ae982f commit 69cf7d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
25 changes: 16 additions & 9 deletions tensorflow/tensorboard/components/vz_projector/data-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class ServerDataProvider implements DataProvider {
retrieveRuns(callback: (runs: string[]) => void): void {
let msgId = logging.setModalMessage('Fetching runs...');
d3.json(`${this.routePrefix}/runs`, (err, runs) => {
if (err) {
logging.setModalMessage('Error: ' + err.responseText);
return;
}
logging.setModalMessage(null, msgId);
callback(runs);
});
Expand All @@ -104,6 +108,10 @@ class ServerDataProvider implements DataProvider {

let msgId = logging.setModalMessage('Fetching checkpoint info...');
d3.json(`${this.routePrefix}/info?run=${run}`, (err, checkpointInfo) => {
if (err) {
logging.setModalMessage('Error: ' + err.responseText);
return;
}
logging.setModalMessage(null, msgId);
this.runCheckpointInfoCache[run] = checkpointInfo;
callback(checkpointInfo);
Expand All @@ -115,9 +123,9 @@ class ServerDataProvider implements DataProvider {
logging.setModalMessage('Fetching tensor values...', TENSORS_MSG_ID);
d3.text(
`${this.routePrefix}/tensor?run=${run}&name=${tensorName}`,
(err: Error, tsv: string) => {
(err: any, tsv: string) => {
if (err) {
console.error(err);
logging.setModalMessage('Error: ' + err.responseText);
return;
}
parseTensors(tsv).then(dataPoints => {
Expand All @@ -131,9 +139,9 @@ class ServerDataProvider implements DataProvider {
logging.setModalMessage('Fetching metadata...', METADATA_MSG_ID);
d3.text(
`${this.routePrefix}/metadata?run=${run}&name=${tensorName}`,
(err: Error, rawMetadata: string) => {
(err: any, rawMetadata: string) => {
if (err) {
console.error(err);
logging.setModalMessage('Error: ' + err.responseText);
return;
}
parseMetadata(rawMetadata).then(result => callback(result));
Expand Down Expand Up @@ -526,10 +534,9 @@ class DemoDataProvider implements DataProvider {
let separator = demoDataSet.fpath.substr(-3) === 'tsv' ? '\t' : ' ';
let url = `${DemoDataProvider.DEMO_FOLDER}/${demoDataSet.fpath}`;
logging.setModalMessage('Fetching tensors...', TENSORS_MSG_ID);
d3.text(url, (error: Error, dataString: string) => {
d3.text(url, (error: any, dataString: string) => {
if (error) {
console.error(error);
logging.setModalMessage('Error loading data.');
logging.setModalMessage('Error: ' + error.responseText);
return;
}
parseTensors(dataString, separator).then(points => {
Expand All @@ -547,9 +554,9 @@ class DemoDataProvider implements DataProvider {
logging.setModalMessage('Fetching metadata...', METADATA_MSG_ID);
d3.text(
`${DemoDataProvider.DEMO_FOLDER}/${demoDataSet.metadata_path}`,
(err: Error, rawMetadata: string) => {
(err: any, rawMetadata: string) => {
if (err) {
console.error(err);
logging.setModalMessage('Error: ' + err.responseText);
reject(err);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class DataPanel extends DataPanelPolymer {
// Get all the runs.
this.dataProvider.retrieveRuns(runs => {
this.runNames = runs;
// If there is only 1 run, choose that one by default.
if (this.runNames.length === 1) {
// Choose the first run by default.
if (this.runNames.length > 0) {
this.selectedRun = runs[0];
}
});
Expand Down Expand Up @@ -208,7 +208,13 @@ export class DataPanel extends DataPanelPolymer {
.text(this.checkpointInfo.checkpointFile)
.attr('title', this.checkpointInfo.checkpointFile);
this.dataProvider.getDefaultTensor(this.selectedRun, defaultTensor => {
this.selectedTensor = defaultTensor;
if (this.selectedTensor === defaultTensor) {
// Explicitly call the observer. Polymer won't call it if the previous
// string matches the current string.
this._selectedTensorChanged();
} else {
this.selectedTensor = defaultTensor;
}
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
align-items: center;
display: flex;
justify-content: center;
width: 300px;
}

#notify-msgs {
Expand Down

0 comments on commit 69cf7d2

Please sign in to comment.