Skip to content
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

Handle multiple experiments with the same name #240

Merged
Merged
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
24 changes: 8 additions & 16 deletions vscode-trace-extension/src/trace-explorer/trace-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,13 @@ export const fileHandler =

const filePath: string = resolvedTraceURI.fsPath;
if (!filePath) {
traceLogger.addLogMessage(
'Cannot open trace: could not retrieve path from URI for trace ' + resolvedTraceURI,
fileHandler.name
traceLogger.showError(
'Cannot open trace: could not retrieve path from URI for trace ' + resolvedTraceURI
);
return;
}

const name = path.basename(filePath);
const panel = TraceViewerPanel.createOrShow(context.extensionUri, name, undefined);

progress.report({ message: ProgressMessages.FINDING_TRACES, increment: 10 });
/*
* TODO: use backend service to find traces
Expand All @@ -98,11 +95,7 @@ export const fileHandler =

if (tracesArray.length === 0) {
progress.report({ message: ProgressMessages.COMPLETE, increment: 100 });
traceLogger.addLogMessage(
'No valid traces found in the selected directory: ' + resolvedTraceURI,
fileHandler.name
);
panel.dispose();
traceLogger.showError('No valid traces found in the selected directory: ' + resolvedTraceURI);
return;
}

Expand All @@ -114,29 +107,28 @@ export const fileHandler =
if (trace) {
traces.push(trace);
} else {
traceLogger.addLogMessage('Failed to open trace: ' + traceName, fileHandler.name);
traceLogger.addLogMessage(
'There may be an issue with the server or the trace is invalid.',
fileHandler.name
traceLogger.showError(
'Failed to open trace: ' +
traceName +
'. There may be an issue with the server or the trace is invalid.'
);
}
}

if (token.isCancellationRequested) {
rollbackTraces(traces, 20, progress);
progress.report({ message: ProgressMessages.COMPLETE, increment: 50 });
panel.dispose();
return;
}

progress.report({ message: ProgressMessages.MERGING_TRACES, increment: 40 });
if (traces === undefined || traces.length === 0) {
progress.report({ message: ProgressMessages.COMPLETE, increment: 30 });
panel.dispose();
return;
}

const experiment = await experimentManager.openExperiment(name, traces);
const panel = TraceViewerPanel.createOrShow(context.extensionUri, experiment?.name ?? name, undefined);
if (experiment) {
panel.setExperiment(experiment);
}
Expand Down
Loading