def check_if_build_necessary(exit_if_not_ready=True):
    """Checks the previous hash of the dockerfile against the latest
    version to determine if a rebuild is nescessary"""
    current_dockerfile_hash = hashlib.sha256(get_dockerfile()).hexdigest()
    try:
        with open(os.path.join(os.path.expanduser("~"), ".cstar_perf","cstar_docker_image_hash")) as f:
            previous_dockerfile_hash = f.read().strip()
        needs_rebuild = not current_dockerfile_hash == previous_dockerfile_hash
    except __HOLE__:
        needs_rebuild = True
    if needs_rebuild and exit_if_not_ready:
        print("The Dockerfile has changed since you last built the image. You must rebuild your image:")
        print ("   cstar_docker build")
        exit(1)
dataset/ETHPy150Open datastax/cstar_perf/tool/cstar_perf/docker/cstar_docker.py/check_if_build_necessary