@@ -33,7 +33,6 @@ import (
33
33
"github.com/aws/amazon-ecs-agent/agent/config"
34
34
"github.com/aws/amazon-ecs-agent/agent/dockerclient"
35
35
"github.com/aws/amazon-ecs-agent/agent/dockerclient/dockerapi"
36
- "github.com/aws/amazon-ecs-agent/agent/ecs_client/model/ecs"
37
36
"github.com/aws/amazon-ecs-agent/agent/taskresource"
38
37
"github.com/aws/amazon-ecs-agent/agent/taskresource/asmauth"
39
38
"github.com/aws/amazon-ecs-agent/agent/taskresource/asmsecret"
@@ -49,6 +48,7 @@ import (
49
48
apieni "github.com/aws/amazon-ecs-agent/ecs-agent/api/eni"
50
49
apierrors "github.com/aws/amazon-ecs-agent/ecs-agent/api/errors"
51
50
"github.com/aws/amazon-ecs-agent/ecs-agent/credentials"
51
+ "github.com/aws/amazon-ecs-agent/ecs-agent/ecs_client/model/ecs"
52
52
"github.com/aws/amazon-ecs-agent/ecs-agent/logger"
53
53
"github.com/aws/amazon-ecs-agent/ecs-agent/logger/field"
54
54
"github.com/aws/amazon-ecs-agent/ecs-agent/utils/arn"
@@ -235,9 +235,6 @@ type Task struct {
235
235
// is handled properly so that the state storage continues to work.
236
236
SentStatusUnsafe apitaskstatus.TaskStatus `json:"SentStatus"`
237
237
238
- StartSequenceNumber int64
239
- StopSequenceNumber int64
240
-
241
238
// ExecutionCredentialsID is the ID of credentials that are used by agent to
242
239
// perform some action at the task level, such as pulling image from ECR
243
240
ExecutionCredentialsID string `json:"executionCredentialsID"`
@@ -313,11 +310,6 @@ func TaskFromACS(acsTask *ecsacs.Task, envelope *ecsacs.PayloadMessage) (*Task,
313
310
if err := json .Unmarshal (data , task ); err != nil {
314
311
return nil , err
315
312
}
316
- if task .GetDesiredStatus () == apitaskstatus .TaskRunning && envelope .SeqNum != nil {
317
- task .StartSequenceNumber = * envelope .SeqNum
318
- } else if task .GetDesiredStatus () == apitaskstatus .TaskStopped && envelope .SeqNum != nil {
319
- task .StopSequenceNumber = * envelope .SeqNum
320
- }
321
313
322
314
// Overrides the container command if it's set
323
315
for _ , container := range task .Containers {
@@ -2826,22 +2818,6 @@ func (task *Task) GetAppMesh() *apiappmesh.AppMesh {
2826
2818
return task .AppMesh
2827
2819
}
2828
2820
2829
- // GetStopSequenceNumber returns the stop sequence number of a task
2830
- func (task * Task ) GetStopSequenceNumber () int64 {
2831
- task .lock .RLock ()
2832
- defer task .lock .RUnlock ()
2833
-
2834
- return task .StopSequenceNumber
2835
- }
2836
-
2837
- // SetStopSequenceNumber sets the stop seqence number of a task
2838
- func (task * Task ) SetStopSequenceNumber (seqnum int64 ) {
2839
- task .lock .Lock ()
2840
- defer task .lock .Unlock ()
2841
-
2842
- task .StopSequenceNumber = seqnum
2843
- }
2844
-
2845
2821
// SetPullStartedAt sets the task pullstartedat timestamp and returns whether
2846
2822
// this field was updated or not
2847
2823
func (task * Task ) SetPullStartedAt (timestamp time.Time ) bool {
@@ -3545,10 +3521,6 @@ func (task *Task) IsServiceConnectConnectionDraining() bool {
3545
3521
//
3546
3522
// * GPU
3547
3523
// - Return num of gpus requested (len of GPUIDs field)
3548
- //
3549
- // TODO remove this once ToHostResources is used
3550
- //
3551
- //lint:file-ignore U1000 Ignore all unused code
3552
3524
func (task * Task ) ToHostResources () map [string ]* ecs.Resource {
3553
3525
resources := make (map [string ]* ecs.Resource )
3554
3526
// CPU
@@ -3662,3 +3634,13 @@ func (task *Task) ToHostResources() map[string]*ecs.Resource {
3662
3634
})
3663
3635
return resources
3664
3636
}
3637
+
3638
+ func (task * Task ) HasActiveContainers () bool {
3639
+ for _ , container := range task .Containers {
3640
+ containerStatus := container .GetKnownStatus ()
3641
+ if containerStatus >= apicontainerstatus .ContainerPulled && containerStatus <= apicontainerstatus .ContainerResourcesProvisioned {
3642
+ return true
3643
+ }
3644
+ }
3645
+ return false
3646
+ }
0 commit comments