agent/api/task/status/statusmapping.go
func MapContainerToTaskStatus(knownState apicontainerstatus.ContainerStatus, steadyState apicontainerstatus.ContainerStatus) TaskStatus {
	switch knownState {
	case apicontainerstatus.ContainerStatusNone:
		return TaskStatusNone
	case steadyState:
		return TaskRunning
	case apicontainerstatus.ContainerCreated:
		return TaskCreated
	case apicontainerstatus.ContainerStopped:
		return TaskStopped
	}

	if knownState == apicontainerstatus.ContainerRunning && steadyState == apicontainerstatus.ContainerResourcesProvisioned {
		return TaskCreated
	}

	return TaskStatusNone
}
func MapContainerToTaskStatus(knownState apicontainerstatus.ContainerStatus, steadyState apicontainerstatus.ContainerStatus) TaskStatus {
	switch knownState {
	case apicontainerstatus.ContainerStatusNone:
		return TaskStatusNone
	case steadyState:
		return TaskRunning
	case apicontainerstatus.ContainerCreated:
		return TaskCreated
	case apicontainerstatus.ContainerStopped:
		return TaskStopped
	}

	if knownState == apicontainerstatus.ContainerRunning && steadyState == apicontainerstatus.ContainerResourcesProvisioned {
		return TaskCreated
	}

	return TaskStatusNone
}
// MapContainerToTaskStatus maps the container status to the corresponding task status. The
// transition map is illustrated below.
//
// Container: None -> Pulled -> Created -> Running -> Provisioned -> Stopped -> Zombie
//
// Task     : None ->     Created       ->         Running        -> Stopped