Skip to content

Commit

Permalink
Merge pull request #127 from perftool-incubator/delete-run-all-by-run…
Browse files Browse the repository at this point in the history
…-uuid
  • Loading branch information
k-rister authored Nov 23, 2024
2 parents 1c7441d + dd396ac commit 0daf48d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions queries/cdmq/delete-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ program
async function waitFor(docTypes) {
var numAttempts = 1;
var maxAttempts = 10;
var remainingDocTypes = docTypes;
while (numAttempts <= maxAttempts && docTypes.length > 0) {
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve('done!'), 2000);
Expand All @@ -32,12 +33,10 @@ async function waitFor(docTypes) {
}
}

var nonMetricDocTypes = ['run', 'iteration', 'sample', 'period', 'param', 'tag'];
var remainingDocTypes = nonMetricDocTypes;
var allDocTypes = ['run', 'iteration', 'sample', 'period', 'param', 'tag', 'metric_desc', 'metric_data'];
var q = {};
if (program.run) {
q = { query: { bool: { filter: [{ term: { 'run.run-uuid': program.run } }] } } };
}
cdm.deleteMetrics(program.url, program.run);
cdm.deleteDocs(program.url, nonMetricDocTypes, q);
waitFor(nonMetricDocTypes);
cdm.deleteDocs(program.url, allDocTypes, q);
waitFor(allDocTypes);

0 comments on commit 0daf48d

Please sign in to comment.