in ui/models/job.js [206:263]
static async cancel(
jobs,
currentRepo,
notify,
decisionTaskIdMap = null,
testMode = false,
) {
const jobTerm = jobs.length > 1 ? 'jobs' : 'job';
const taskIdMap =
decisionTaskIdMap ||
(await PushModel.getDecisionTaskMap(
[...new Set(jobs.map((job) => job.push_id))],
notify,
));
try {
notify(`Attempting to cancel selected ${jobTerm} via actions.json`);
/* eslint-disable no-await-in-loop */
for (const job of jobs) {
const decisionTaskId = taskIdMap[job.push_id].id;
let results;
try {
results = await TaskclusterModel.load(
decisionTaskId,
job,
currentRepo,
testMode,
);
} catch (e) {
notify(e.message, 'danger', { sticky: true });
}
try {
const cancelTask = getAction(results.actions, 'cancel');
await TaskclusterModel.submit({
action: cancelTask,
decisionTaskId,
taskId: results.originalTaskId,
input: {},
staticActionVariables: results.staticActionVariables,
currentRepo,
testMode,
});
} catch (e) {
// The full message is too large to fit in a Treeherder
// notification box.
notify(formatTaskclusterError(e), 'danger', { sticky: true });
}
}
/* eslint-enable no-await-in-loop */
notify(`Request sent to cancel ${jobTerm} via action.json`, 'success');
} catch {
notify(`Unable to cancel ${jobTerm}`, 'danger', { sticky: true });
}
}