def remove_cgroup(cgroup):
    if not os.path.exists(cgroup):
        logging.warning('Cannot remove CGroup %s, because it does not exist.', cgroup)
        return
    assert os.path.getsize(os.path.join(cgroup, 'tasks')) == 0
    try:
        os.rmdir(cgroup)
    except OSError:
        # sometimes this fails because the cgroup is still busy, we try again once
        try:
            os.rmdir(cgroup)
        except __HOLE__ as e:
            logging.warning("Failed to remove cgroup %s: error %s (%s)",
                            cgroup, e.errno, e.strerror)
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/cgroups.py/remove_cgroup