瀏覽代碼

Compute machine type matching reservations

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 5 年之前
父節點
當前提交
d57a39958b
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 4 1
      ecs/ec2.go
  2. 1 1
      ecs/gpu.go

+ 4 - 1
ecs/ec2.go

@@ -46,7 +46,10 @@ func (b *ecsAPIService) createCapacityProvider(ctx context.Context, project *typ
 		return err
 	}
 
-	machineType := "g4dn.xlarge" // FIXME https://github.com/docker/compose-cli/pull/628
+	machineType, err := guessMachineType(project)
+	if err != nil {
+		return err
+	}
 
 	var securityGroups []string
 	for _, r := range networks {

+ 1 - 1
ecs/gpu.go

@@ -108,7 +108,7 @@ func guessMachineType(project *types.Project) (string, error) {
 
 	instanceType, err := gpufamily.
 		filter(func(m machine) bool {
-			return m.memory >= requirements.memory
+			return m.memory > requirements.memory // actual memory available for ECS tasks < total machine memory
 		}).
 		filter(func(m machine) bool {
 			return m.cpus >= requirements.cpus