示例#1
0
    def has_connectivity_on(self, address):

        try:
            log_verbose("Checking if server '%s' is accessible on "
                        "address '%s'" % (self.id, address))
            mongo_utils.mongo_client(address)
            return True
        except Exception, e:
            log_exception(e)
            log_verbose("Check failed for server '%s' is accessible on "
                        "address '%s': %s" % (self.id, address, e))
            return False
示例#2
0
    def has_connectivity_on(self, address):

        try:
            log_verbose("Checking if server '%s' is accessible on "
                        "address '%s'" % (self.id, address))
            mongo_utils.mongo_client(address)
            return True
        except Exception, e:
            log_exception(e)
            log_verbose("Check failed for server '%s' is accessible on "
                        "address '%s': %s" % (self.id, address, e))
            return False
示例#3
0
    def new_mongo_client(self, **kwargs):
        address = self.get_connection_address()
        kwargs = kwargs or {}
        if self.connection_timeout_ms:
            kwargs["connectTimeoutMS"] = self.connection_timeout_ms

        return mongo_utils.mongo_client(address, **kwargs)
示例#4
0
    def new_mongo_client(self, **kwargs):
        address = self.get_connection_address()
        kwargs = kwargs or {}
        if self.connection_timeout_ms:
            kwargs["connectTimeoutMS"] = self.connection_timeout_ms

        return mongo_utils.mongo_client(address, **kwargs)