Created
April 5, 2017 23:29
-
-
Save beltran/733263e06f055f77e6a7816a46b93aa3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cassandra.io.eventletreactor import EventletConnection | |
from cassandra.io.geventreactor import GeventConnection | |
from cassandra.io.libevreactor import LibevConnection | |
from cassandra.io.asyncorereactor import AsyncoreConnection | |
connection_class = GeventConnection | |
if connection_class == EventletConnection: | |
from eventlet import monkey_patch | |
monkey_patch() | |
elif connection_class == GeventConnection: | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
from cassandra.cluster import Cluster | |
import logging | |
import time | |
log = logging.getLogger() | |
log.setLevel('DEBUG') | |
handler = logging.StreamHandler() | |
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s")) | |
log.addHandler(handler) | |
KEYSPACE = "testkeyspace" | |
cluster = Cluster(['127.0.0.1'], connection_class=connection_class) | |
session = cluster.connect() | |
while 1: | |
try: | |
log.info("Executing select in main") | |
future = session.execute("SELECT * FROM system.hints") | |
except: | |
pass | |
time.sleep(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment