code: func (engine *DockerTaskEngine) newManagedTask(task *apitask.Task) *managedTask {
  	ctx, cancel := context.WithCancel(engine.ctx)
  	t := &managedTask{
  		ctx:                        ctx,
  		cancel:                     cancel,
  		Task:                       task,
  		acsMessages:                make(chan acsTransition),
  		dockerMessages:             make(chan dockerContainerChange),
  		resourceStateChangeEvent:   make(chan resourceStateChange),
  		engine:                     engine,
  		cfg:                        engine.cfg,
  		stateChangeEvents:          engine.stateChangeEvents,
  		containerChangeEventStream: engine.containerChangeEventStream,
  		saver:                      engine.saver,
  		credentialsManager:         engine.credentialsManager,
  		cniClient:                  engine.cniClient,
  		taskStopWG:                 engine.taskStopGroup,
  		steadyStatePollInterval:    engine.taskSteadyStatePollInterval,
  	}
  	engine.managedTasks[task.Arn] = t
  	return t
  }
docs: // newManagedTask is a method on DockerTaskEngine to create a new managedTask.
  // This method must only be called when the engine.processTasks write lock is
  // already held.