make detail archive opening more robust (#16071)

This commit is contained in:
Vadim Ogievetsky 2024-03-08 10:55:31 -08:00 committed by GitHub
parent 775c1180ae
commit 19a8af866b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 6 deletions

View File

@ -18,6 +18,11 @@
import * as JSONBig from 'json-bigint-native';
import type {
AsyncStatusResponse,
MsqTaskPayloadResponse,
MsqTaskReportResponse,
} from '../druid-models';
import { Api } from '../singletons';
import { downloadFile } from './download';
@ -26,9 +31,9 @@ export interface QueryDetailArchive {
id: string;
detailArchiveVersion: number;
status?: any;
reports?: any;
payload?: any;
statementsStatus?: any;
reports?: MsqTaskReportResponse;
payload?: MsqTaskPayloadResponse;
statementsStatus?: AsyncStatusResponse;
serverStatus?: any;
}

View File

@ -82,9 +82,27 @@ export const ExecutionSubmitDialog = React.memo(function ExecutionSubmitDialog(
if (typeof detailArchiveVersion === 'number') {
try {
if (detailArchiveVersion === 2) {
execution = Execution.fromTaskReport(parsed.reports)
.updateWithTaskPayload(parsed.payload)
.updateWithAsyncStatus(parsed.statementsStatus);
if (parsed.reports) {
execution = Execution.fromTaskReport(parsed.reports);
}
if (parsed.statementsStatus) {
execution = execution
? execution.updateWithAsyncStatus(parsed.statementsStatus)
: Execution.fromAsyncStatus(parsed.statementsStatus);
}
if (!execution) {
AppToaster.show({
intent: Intent.DANGER,
message: `Not enough information to decode detail archive`,
});
return;
}
if (parsed.payload) {
execution = execution.updateWithTaskPayload(parsed.payload);
}
} else {
AppToaster.show({
intent: Intent.DANGER,
@ -97,6 +115,7 @@ export const ExecutionSubmitDialog = React.memo(function ExecutionSubmitDialog(
intent: Intent.DANGER,
message: `Could not decode profile: ${e.message}`,
});
console.log(e); // Log out the error to the console in case we want to debug this further. This is very much a power user feature.
return;
}
} else if (typeof (parsed as any).multiStageQuery === 'object') {