@wrap_exception('Unable to check Docker container status')
    def check_finished(self, container_id):
        with closing(self._create_connection()) as conn:
            conn.request('GET', '/containers/%s/json' % container_id)
            inspect_response = conn.getresponse()
            if inspect_response.status == 404:
                return (True, None, 'Lost by Docker')
            if inspect_response.status != 200:
                raise DockerException(inspect_response.read())
            
            inspect_json = json.loads(inspect_response.read())
            if not inspect_json['State']['Running']:
                return (True, inspect_json['State']['ExitCode'], None)
            return (False, None, None)
dataset/ETHPy150Open codalab/codalab-cli/worker/docker_client.py/DockerClient.check_finished/original