Last active
August 10, 2016 20:55
-
-
Save gregarndt/6b27182c2879bcc77082c811dd86041a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import taskcluster from 'taskcluster-client'; | |
let taskGroupId = 'cfMDvTzETHagYx-uSPCOxQ'; | |
async () => { | |
let queue = new taskcluster.Queue(); | |
let continuationToken; | |
let cancellations = []; | |
do { | |
let result = await queue.listTaskGroup(taskGroupId, continuationToken? {continuationToken} : {}); | |
continuationToken = result.continuationToken; | |
for (let task of result.tasks) { | |
if (["pending", "running"].includes(task.status.state)) { | |
console.log(`cancelling ${task.status.taskId}`); | |
cancellations.push(queue.cancelTask(task.status.taskId)); | |
} | |
} | |
} while(continuationToken) | |
console.log(`waiting for ${cancellations.length} to finish`); | |
await Promise.all(cancellations); | |
}().catch(e => {console.log(e)}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment