From 5250b8314385fdb3e0f94395af9e3c4cae3e1b2e Mon Sep 17 00:00:00 2001 From: ingalls Date: Wed, 13 Mar 2024 09:31:41 -0600 Subject: [PATCH] More FaultTolerant Run Post --- api/lib/types/run.js | 11 +++++++++-- api/schema/res.SingleJobsCreate.json | 6 ++++++ cloudformation/lib/api.js | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/api/lib/types/run.js b/api/lib/types/run.js index 967139e4..de538819 100644 --- a/api/lib/types/run.js +++ b/api/lib/types/run.js @@ -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, { @@ -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 + }) } } @@ -220,6 +226,7 @@ export default class Run extends Generic { return { run: run_id, + errors: errors, jobs: jobs.map((job) => { return job.id; }) diff --git a/api/schema/res.SingleJobsCreate.json b/api/schema/res.SingleJobsCreate.json index a56bca33..746c4089 100644 --- a/api/schema/res.SingleJobsCreate.json +++ b/api/schema/res.SingleJobsCreate.json @@ -9,6 +9,12 @@ "run": { "type": "integer" }, + "errors": { + "type": "array", + "items": { + "type": "object" + } + }, "jobs": { "type": "array", "items": { diff --git a/cloudformation/lib/api.js b/cloudformation/lib/api.js index b93491c1..7e8eace2 100644 --- a/cloudformation/lib/api.js +++ b/cloudformation/lib/api.js @@ -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',