def bootstrap(config, git_fetch=True, revision_override=None):
    revision = revision_override or config['revision']

    if git_fetch:
        update_cassandra_git()

    fab.run('rm -rf ~/fab/cassandra')

    # Find the SHA for the revision requested:
    git_id = fab.run('git --git-dir=$HOME/fab/cassandra.git rev-parse {revision}'.format(revision=revision)).strip()
    # Check if we have already built the revision requested.
    # This speeds up consecutive runs of the same revision.
    fab.run('mkdir -p ~/fab/cassandra_builds')
    test_already_built = fab.run('test -d ~/fab/cassandra_builds/{git_id}'.format(git_id=git_id), quiet=True)
    if test_already_built.return_code == 0:
        # Copy previously built Cassandra
        fab.run('cp -a ~/fab/cassandra_builds/{git_id} ~/fab/cassandra'.format(git_id=git_id))
    else:
        # Build Cassandra
        # Checkout revision/tag:
        fab.run('mkdir ~/fab/cassandra')
        fab.run('git --git-dir=$HOME/fab/cassandra.git archive %s |'
                ' tar x -C ~/fab/cassandra' % revision)
        fab.run('echo -e \'%s\\n%s\\n%s\' > ~/fab/cassandra/0.GIT_REVISION.txt' %
                (revision, git_id, config.get('log','')))

        fab.run('JAVA_HOME={java_home} ~/fab/ant/bin/ant -f ~/fab/cassandra/build.xml clean'.format(java_home=config['java_home']))
        if config['override_version'] is not None:
            fab.run('JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 JAVA_HOME={java_home} ~/fab/ant/bin/ant -f ~/fab/cassandra/build.xml -Dversion={version}'.format(java_home=config['java_home'], version=config['override_version']))
        else:
            fab.run('JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 JAVA_HOME={java_home} ~/fab/ant/bin/ant -f ~/fab/cassandra/build.xml'.format(java_home=config['java_home']))

        # Archive this build for future runs:
        fab.run('cp -a ~/fab/cassandra ~/fab/cassandra_builds/{git_id}'.format(git_id=git_id))

        # Remove old builds:
        num_builds = int(fab.run('ls -1 ~/fab/cassandra_builds | wc -l').strip())
        if num_builds > MAX_CACHED_BUILDS:
            fab.run('ls -t1 ~/fab/cassandra_builds | tail -n {num_to_delete} | xargs -iXX rm -rf ~/fab/cassandra_builds/XX'.format(
                num_to_delete=num_builds-MAX_CACHED_BUILDS))

    return git_id
Install and configure Cassandra
dataset/ETHPy150Open datastax/cstar_perf/tool/cstar_perf/tool/fab_cassandra.py/bootstrap