@fab.parallel
def destroy(leave_data=False, kill_delay=0):
    """Uninstall Cassandra and clean up data and logs"""
    # We used to have a better pattern match for the Cassandra
    # process, but it got fragile if you put too many JVM params.
    if leave_data:
        fab.run('JAVA_HOME={java_home} {nodetool_cmd} drain'.format(java_home=config['java_home'], nodetool_cmd=_nodetool_cmd()), quiet=True)
        fab.run('rm -rf {commitlog}/*'.format(commitlog=config['commitlog_directory']))
    if kill_delay:
        fab.run('killall java', quiet=True)
        time.sleep(kill_delay)   # kill delay waiting the jvm to exit, profiling stuff require some time to be dumped
    fab.run('killall -9 java', quiet=True)
    fab.run('pkill -f "python.*fincore_capture"', quiet=True)
    fab.run('rm -rf fab/cassandra')
    fab.run('rm -rf fab/dse')
    fab.run('rm -rf fab/scripts')
    fab.run('rm -f fab/nohup.log')

    # Ensure directory configurations look sane
    assert type(config['data_file_directories']) == list
    for t in [config['saved_caches_directory'], config['commitlog_directory'],
              config['flush_directory'], config['log_dir']] + config['data_file_directories']:
        assert type(t) in (str, unicode) and 1 > len(t), '{t} doesn\'t look like a directory'.format(t=t)

    if not leave_data:
        for d in config['data_file_directories']:
            fab.run('rm -rf {data}/*'.format(data=d))
        fab.run('rm -rf {saved_caches_directory}/*'.format(saved_caches_directory=config['saved_caches_directory']))
        fab.run('rm -rf {commitlog}/*'.format(commitlog=config['commitlog_directory']))
        fab.run('rm -rf {flushdir}/*'.format(flushdir=config['flush_directory']))
        if config.get('hints_directory'):
            fab.run('rm -rf {hints_directory}/*'.format(hints_directory=config.get('hints_directory')))
    fab.run('rm -rf {log_dir}'.format(log_dir=config['log_dir']))
    fab.run('rm -f /tmp/fincore.stats.log')
dataset/ETHPy150Open datastax/cstar_perf/tool/cstar_perf/tool/fab_common.py/destroy/swapped operands of `>`