本文整理汇总了Golang中github.com/aws/amazon-ecs-agent/agent/api.Container.SetDesiredStatus方法的典型用法代码示例。如果您正苦于以下问题:Golang Container.SetDesiredStatus方法的具体用法?Golang Container.SetDesiredStatus怎么用?Golang Container.SetDesiredStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/amazon-ecs-agent/agent/api.Container
的用法示例。
在下文中一共展示了Container.SetDesiredStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: pullContainer
func (engine *DockerTaskEngine) pullContainer(task *api.Task, container *api.Container) DockerContainerMetadata {
log.Info("Pulling container", "task", task, "container", container)
seelog.Debugf("Attempting to obtain ImagePullDeleteLock to pull image - %s", container.Image)
ImagePullDeleteLock.Lock()
seelog.Debugf("Obtained ImagePullDeleteLock to pull image - %s", container.Image)
defer seelog.Debugf("Released ImagePullDeleteLock after pulling image - %s", container.Image)
defer ImagePullDeleteLock.Unlock()
// If a task is blocked here for some time, and before it starts pulling image,
// the task's desired status is set to stopped, then don't pull the image
if task.GetDesiredStatus() == api.TaskStopped {
seelog.Infof("Task desired status is stopped, skip pull container: %v, task %v", container, task)
container.SetDesiredStatus(api.ContainerStopped)
return DockerContainerMetadata{Error: TaskStoppedBeforePullBeginError{task.Arn}}
}
metadata := engine.client.PullImage(container.Image, container.RegistryAuthentication)
err := engine.imageManager.AddContainerReferenceToImageState(container)
if err != nil {
seelog.Errorf("Error adding container reference to image state: %v", err)
}
imageState := engine.imageManager.GetImageStateFromImageName(container.Image)
engine.state.AddImageState(imageState)
engine.saver.Save()
return metadata
}