Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit 42a824d

Browse files
committed
use separate aws fargate task definition for 30gb workers
1 parent c7a072c commit 42a824d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/worker/lib/executors/fargate.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ func (f *Fargate) wrapExecutorError(err error) error {
5656
}
5757

5858
func (f Fargate) runTask(ctx context.Context, req *Requirements) (*ecs.Task, error) {
59+
const defaultMemGB = 16
60+
taskDef := f.cfg.GetString("FARGATE_TASK_DEF")
61+
if req.MemoryGB > defaultMemGB {
62+
taskDef = f.cfg.GetString("FARGATE_MAX_MEM_TASK_DEF")
63+
}
64+
5965
input := &ecs.RunTaskInput{
6066
Count: aws.Int64(1),
6167
NetworkConfiguration: &ecs.NetworkConfiguration{
@@ -67,7 +73,7 @@ func (f Fargate) runTask(ctx context.Context, req *Requirements) (*ecs.Task, err
6773
},
6874
LaunchType: aws.String("FARGATE"),
6975
Cluster: aws.String(f.cfg.GetString("FARGATE_CLUSTER")),
70-
TaskDefinition: aws.String(f.cfg.GetString("FARGATE_TASK_DEF")),
76+
TaskDefinition: aws.String(taskDef),
7177
Overrides: &ecs.TaskOverride{
7278
ContainerOverrides: []*ecs.ContainerOverride{
7379
{
@@ -78,8 +84,6 @@ func (f Fargate) runTask(ctx context.Context, req *Requirements) (*ecs.Task, err
7884
Value: aws.String(f.token),
7985
},
8086
},
81-
Cpu: aws.Int64(int64(req.CPUCount * 1024)), // default is 4 vCPU
82-
Memory: aws.Int64(int64(req.MemoryGB * 1024)), // default is 16 GB
8387
},
8488
},
8589
},
@@ -313,6 +317,7 @@ func (f Fargate) Clean() {
313317
})
314318
if err != nil {
315319
f.log.Warnf("Failed to stop fargate task: %s", err)
320+
return
316321
}
317322
f.log.Infof("Stopped fargate task %s", f.taskID)
318323
}

0 commit comments

Comments
 (0)