@@ -11,7 +11,6 @@ import (
11
11
"path/filepath"
12
12
"sort"
13
13
"strings"
14
- "time"
15
14
16
15
"github.com/aws/aws-sdk-go/aws"
17
16
"github.com/aws/aws-sdk-go/service/ec2"
@@ -412,37 +411,3 @@ func (i *instance) isUnattachedSpotInstanceLaunchedForAnEnabledASG() bool {
412
411
}
413
412
return false
414
413
}
415
-
416
- // returns an instance ID as *string, set to nil if we need to wait for the next
417
- // run in case there are no spot instances
418
- func (i * instance ) isReadyToAttach (asg * autoScalingGroup ) bool {
419
-
420
- log .Println ("Considering " , * i .InstanceId , "for attaching to" , asg .name )
421
-
422
- gracePeriod := * asg .HealthCheckGracePeriod
423
-
424
- instanceUpTime := time .Now ().Unix () - i .LaunchTime .Unix ()
425
-
426
- log .Println ("Instance uptime:" , time .Duration (instanceUpTime )* time .Second )
427
-
428
- // Check if the spot instance is out of the grace period, so in that case we
429
- // can replace an on-demand instance with it
430
- if * i .State .Name == ec2 .InstanceStateNameRunning &&
431
- instanceUpTime > gracePeriod {
432
- log .Println ("The spot instance" , * i .InstanceId ,
433
- " has passed grace period and is ready to attach to the group." )
434
- return true
435
- } else if * i .State .Name == ec2 .InstanceStateNameRunning &&
436
- instanceUpTime < gracePeriod {
437
- log .Println ("The spot instance" , * i .InstanceId ,
438
- "is still in the grace period," ,
439
- "waiting for it to be ready before we can attach it to the group..." )
440
- return false
441
- } else if * i .State .Name == ec2 .InstanceStateNamePending {
442
- log .Println ("The spot instance" , * i .InstanceId ,
443
- "is still pending," ,
444
- "waiting for it to be running before we can attach it to the group..." )
445
- return false
446
- }
447
- return false
448
- }
0 commit comments