agent/engine/docker_task_engine.go
func (engine *DockerTaskEngine) checkTaskState(task *apitask.Task) {
	defer metrics.MetricsEngineGlobal.RecordTaskEngineMetric("CHECK_TASK_STATE")()
	taskContainers, ok := engine.state.ContainerMapByArn(task.Arn)
	if !ok {
		seelog.Warnf("Task engine [%s]: could not check task state; no task in state", task.Arn)
		return
	}
	for _, container := range task.Containers {
		dockerContainer, ok := taskContainers[container.Name]
		if !ok {
			continue
		}
		status, metadata := engine.client.DescribeContainer(engine.ctx, dockerContainer.DockerID)
		engine.tasksLock.RLock()
		managedTask, ok := engine.managedTasks[task.Arn]
		engine.tasksLock.RUnlock()

		if ok {
			managedTask.emitDockerContainerChange(dockerContainerChange{
				container: container,
				event: dockerapi.DockerContainerChangeEvent{
					Status:                  status,
					DockerContainerMetadata: metadata,
				},
			})
		}
	}
}
func (engine *DockerTaskEngine) checkTaskState(task *apitask.Task) {
	defer metrics.MetricsEngineGlobal.RecordTaskEngineMetric("CHECK_TASK_STATE")()
	taskContainers, ok := engine.state.ContainerMapByArn(task.Arn)
	if !ok {
		seelog.Warnf("Task engine [%s]: could not check task state; no task in state", task.Arn)
		return
	}
	for _, container := range task.Containers {
		dockerContainer, ok := taskContainers[container.Name]
		if !ok {
			continue
		}
		status, metadata := engine.client.DescribeContainer(engine.ctx, dockerContainer.DockerID)
		engine.tasksLock.RLock()
		managedTask, ok := engine.managedTasks[task.Arn]
		engine.tasksLock.RUnlock()

		if ok {
			managedTask.emitDockerContainerChange(dockerContainerChange{
				container: container,
				event: dockerapi.DockerContainerChangeEvent{
					Status:                  status,
					DockerContainerMetadata: metadata,
				},
			})
		}
	}
}
func ( engine * DockerTaskEngine ) checkTaskState ( task * apitask . Task ) { defer metrics . MetricsEngineGlobal . RecordTaskEngineMetric ( " " ) ( ) taskContainers , ok := engine . state . ContainerMapByArn ( task . Arn ) if ! ok { seelog . Warnf ( " " , task . Arn ) return } for _ , container := range task . Containers { dockerContainer , ok := taskContainers [ container . Name ] if ! ok { continue } status , metadata := engine . client . DescribeContainer ( engine . ctx , dockerContainer . DockerID ) engine . tasksLock . RLock ( ) managedTask , ok := engine . managedTasks [ task . Arn ] engine . tasksLock . RUnlock ( ) if ok { managedTask . emitDockerContainerChange ( dockerContainerChange { container : container , event : dockerapi . DockerContainerChangeEvent { Status : status , DockerContainerMetadata : metadata , } , } ) } } }
// checkTaskState inspects the state of all containers within a task and writes
// their state to the managed task's container channel.
checkTaskState inspects the state of all containers within a task and writes their state to the managed task s container channel .