Fail fast when gevent monkey-patching is detected

Fixes #43
This commit is contained in:
Tyler Hobbs
2013-09-26 12:58:35 -05:00
parent e49ff037c3
commit c85a323d63

View File

@@ -5,6 +5,7 @@ This module houses the main classes you will interact with,
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
import logging import logging
import sys
import time import time
from threading import Lock, RLock, Thread, Event from threading import Lock, RLock, Thread, Event
import Queue import Queue
@@ -213,6 +214,12 @@ class Cluster(object):
Any of the mutable Cluster attributes may be set as keyword arguments Any of the mutable Cluster attributes may be set as keyword arguments
to the constructor. to the constructor.
""" """
if 'gevent.monkey' in sys.modules:
raise Exception(
"gevent monkey-patching detected. This driver does not currently "
"support gevent, and monkey patching will break the driver "
"completely. You can track progress towards adding gevent "
"support here: https://datastax-oss.atlassian.net/browse/PYTHON-7.")
self.contact_points = contact_points self.contact_points = contact_points
self.port = port self.port = port