@@ -56,6 +56,12 @@ func (f *Fargate) wrapExecutorError(err error) error {
56
56
}
57
57
58
58
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
+
59
65
input := & ecs.RunTaskInput {
60
66
Count : aws .Int64 (1 ),
61
67
NetworkConfiguration : & ecs.NetworkConfiguration {
@@ -67,7 +73,7 @@ func (f Fargate) runTask(ctx context.Context, req *Requirements) (*ecs.Task, err
67
73
},
68
74
LaunchType : aws .String ("FARGATE" ),
69
75
Cluster : aws .String (f .cfg .GetString ("FARGATE_CLUSTER" )),
70
- TaskDefinition : aws .String (f . cfg . GetString ( "FARGATE_TASK_DEF" ) ),
76
+ TaskDefinition : aws .String (taskDef ),
71
77
Overrides : & ecs.TaskOverride {
72
78
ContainerOverrides : []* ecs.ContainerOverride {
73
79
{
@@ -78,8 +84,6 @@ func (f Fargate) runTask(ctx context.Context, req *Requirements) (*ecs.Task, err
78
84
Value : aws .String (f .token ),
79
85
},
80
86
},
81
- Cpu : aws .Int64 (int64 (req .CPUCount * 1024 )), // default is 4 vCPU
82
- Memory : aws .Int64 (int64 (req .MemoryGB * 1024 )), // default is 16 GB
83
87
},
84
88
},
85
89
},
@@ -313,6 +317,7 @@ func (f Fargate) Clean() {
313
317
})
314
318
if err != nil {
315
319
f .log .Warnf ("Failed to stop fargate task: %s" , err )
320
+ return
316
321
}
317
322
f .log .Infof ("Stopped fargate task %s" , f .taskID )
318
323
}
0 commit comments