def __init__(self): """ The only async framework that PyMongo fully supports is Gevent. Currently there is no great way to use PyMongo in conjunction with Tornado or Twisted. PyMongo provides built-in connection pooling, so some of the benefits of those frameworks can be achieved just by writing multi-threaded code that shares a MongoClient. """ self.style = color.color_style() try: client = MongoClient(self.MONGODB_SERVER,self.MONGODB_PORT) self.db = client[self.MONGODB_DB] except Exception as e: print self.style.ERROR("ERROR(ShardMongodbPipeline): %s"%(str(e),)) traceback.print_exc()
def __init__(self, original_url="", *args): self.original_url = original_url self.style = color.color_style() DropItem.__init__(self, *args)