Skip to content

Commit 56a9e55

Browse files
committed
profile: fix loading progress behavior (#1945)
Summary: The profile dashboard had an existing bug that was revealed by #1914: the loading progress bar never actually finishes. Prior to #1914, you could actually see the loading bar if you made your window narrow enough: ![Screenshot of a zombie progress bar](https://user-images.githubusercontent.com/4317806/53674700-95317580-3c44-11e9-924f-82f6dc8d5f18.png) This was because the prior version of the dashboard rendered the main tool irrespective of whether the data had actually finished loading. As of #1914, the “loading” and “active” states are mutually exclusive, so instead of just having a zombie progress bar we actually block the view. The cause of the bug is a promise that never resolves. (The executor provided to the `Promise` constructor’s return value is ignored; only the `resolve` and `reject` callbacks can fulfill a promise.) This was not caught while testing #1914 because it cannot be reproduced with the demo data present at that commit; with that more complete set of data, there are other code paths that clobber the progress value to 100% (which is really a separate issue, but that’s not important right now), such as `_maybeUpdateData`. Test Plan: Regenerate profile plugin demo data if you haven’t done so since #1942, then launch TensorBoard: ``` $ rm -rf /tmp/profile_demo/ $ bazel run //tensorboard/plugins/profile:profile_demo $ bazel run //tensorboard -- --logdir /tmp/profile_demo ``` The trace viewer should be displayed (prior to this commit, it wasn’t). wchargin-branch: profile-broken-promises
1 parent def37cc commit 56a9e55

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tensorboard/plugins/profile/tf_profile_dashboard/tf-profile-dashboard.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,13 @@ <h3>No profile data was found.</h3>
425425
'Processing datasets', 70, () => {
426426
return new Promise(function(resolve, reject) {
427427
parent._processRunToTool(runToTool);
428-
return Promise.resolve(null);
428+
resolve(null);
429429
});
430430
}, tracker);
431431
})
432432
.then(() => {
433433
return tf.profile.util.runTask(
434-
'Done', 10, () => {
435-
return new Promise(function(resolve, reject) {
436-
return Promise.resolve(null);
437-
});
438-
}, tracker);
434+
'Done', 10, () => null, tracker);
439435
});
440436
},
441437
_processRunToTool: function(runToTool) {

0 commit comments

Comments
 (0)