Skip to content

Commit

Permalink
More FaultTolerant Run Post
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Mar 13, 2024
1 parent 26256b2 commit 5250b83
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/lib/types/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export default class Run extends Generic {
}
}

const errors = [];
for (let i = 0; i < jobs.length; i++) {
try {
jobs[i] = await Job.generate(pool, {
Expand All @@ -205,8 +206,13 @@ export default class Run extends Generic {

await jobs[i].batch(run.github && run.github.check);
} catch (err) {
// TODO return list of successful ids
throw new Err(500, err, 'jobs only partially queued');
errors.push({
error: err.message,
run: run_id,
source: jobs[i].source,
layer: jobs[i].layer,
name: jobs[i].name
})
}
}

Expand All @@ -220,6 +226,7 @@ export default class Run extends Generic {

return {
run: run_id,
errors: errors,
jobs: jobs.map((job) => {
return job.id;
})
Expand Down
6 changes: 6 additions & 0 deletions api/schema/res.SingleJobsCreate.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
"run": {
"type": "integer"
},
"errors": {
"type": "array",
"items": {
"type": "object"
}
},
"jobs": {
"type": "array",
"items": {
Expand Down
4 changes: 4 additions & 0 deletions cloudformation/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
Name: cf.stackName,
Type: 'application',
SecurityGroups: [cf.ref('APIELBSecurityGroup')],
"LoadBalancerAttributes": [{
Key: "idle_timeout.timeout_seconds",
Value: 600
}],
Subnets: [
'subnet-de35c1f5',
'subnet-e67dc7ea',
Expand Down

0 comments on commit 5250b83

Please sign in to comment.