Skip to content

Embedding Projector: show error on task failure #6326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class DemoDataProvider implements DataProvider {
const xhr = new XMLHttpRequest();
xhr.open('GET', embedding.bookmarksPath!);
xhr.onerror = (err) => {
logging.setErrorMessage(xhr.responseText);
logging.setErrorMessage(xhr.responseText, 'fetching bookmarks');
};
xhr.onload = () => {
const bookmarks = JSON.parse(xhr.responseText) as State[];
Expand Down
26 changes: 16 additions & 10 deletions tensorboard/plugins/projector/vz_projector/data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export function retrieveTensorAsBytes(
let data: Float32Array;
try {
data = new Float32Array(xhr.response);
} catch (e: any) {
logging.setErrorMessage(e, 'parsing tensor bytes');
} catch (ex: any) {
logging.setErrorMessage((ex as Error).message, 'parsing tensor bytes');
return;
}
let dim = embedding.tensorShape[1];
Expand Down Expand Up @@ -241,14 +241,16 @@ export function parseTensors(
numDim = dataPoint.vector.length;
}
if (numDim !== dataPoint.vector.length) {
logging.setModalMessage(
'Parsing failed. Vector dimensions do not match'
logging.setErrorMessage(
'Vector dimensions do not match',
'parsing tensors'
);
throw Error('Parsing failed');
}
if (numDim <= 1) {
logging.setModalMessage(
'Parsing failed. Found a vector with only one dimension?'
logging.setErrorMessage(
'Found a vector with only one dimension?',
'parsing tensors'
);
throw Error('Parsing failed');
}
Expand Down Expand Up @@ -445,18 +447,22 @@ export function retrieveSpriteAndMetadataInfo(
(spriteImage.height > MAX_SPRITE_IMAGE_SIZE_PX ||
spriteImage.width > MAX_SPRITE_IMAGE_SIZE_PX)
) {
logging.setModalMessage(
logging.setErrorMessage(
`Error: Sprite image of dimensions ${spriteImage.width}px x ` +
`${spriteImage.height}px exceeds maximum dimensions ` +
`${MAX_SPRITE_IMAGE_SIZE_PX}px x ${MAX_SPRITE_IMAGE_SIZE_PX}px`
`${MAX_SPRITE_IMAGE_SIZE_PX}px x ${MAX_SPRITE_IMAGE_SIZE_PX}px`,
'parsing sprite images'
);
} else {
metadata.spriteImage = spriteImage!;
metadata.spriteMetadata = spriteMetadata;
try {
callback(metadata);
} catch (e) {
logging.setModalMessage(String(e));
} catch (ex) {
logging.setErrorMessage(
(ex as Error).message,
'parsing sprite metadata'
);
}
}
});
Expand Down
1 change: 1 addition & 0 deletions tensorboard/plugins/projector/vz_projector/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export function runAsyncTask<T>(
}
resolve(result);
} catch (ex) {
logging.setErrorMessage((ex as Error).message);
reject(ex);
}
return true;
Expand Down