'Update buildenv state from container state
In the case of the parent command exiting before the exec commands
finish and the container is destroyed, or in the case of OOM on the
container, set a failure state and error message explaining the failure
on the buildenv.'

def update_build_from_container_state(self):

    state = self.container_state()
    if ((state is not None) and (state.get('Running') is False)):
        if (state.get('ExitCode') == DOCKER_TIMEOUT_EXIT_CODE):
            self.failure = BuildEnvironmentError(_('Build    exited    due    to    time    out'))
        elif state.get('OOMKilled', False):
            self.failure = BuildEnvironmentError(_('Build    exited    due    to    excessive    memory    consumption'))
        elif state.get('Error'):
            self.failure = BuildEnvironmentError(_('Build    exited    due    to    unknown    error:    {0}').format(state.get('Error')))
