Esempio n. 1
0
    def __init__(self,
                 servers,
                 partition_key=None,
                 timeout=3,
                 allow_time_travel=False,
                 checkpoint=0,
                 checkpoint_time=0,
                 max_drift=600,
                 mark_bad_timeout=60,
                 max_backend_tries=5):

        self._lock = Lock()
        self.timeout = timeout
        self.backends = Backends(servers, partition_key)

        self.checkpoint = checkpoint
        self.checkpoint = checkpoint_time

        self.allow_time_travel = allow_time_travel
        self.max_drift = max_drift
        self.mark_bad_timeout = mark_bad_timeout
        self.max_backend_tries = max_backend_tries

        self.users = Users(self, "users")
        self.groups = Groups(self, "groups")
        self.permissions = Permissions(self, "permissions")
Esempio n. 2
0
    def __init__(self,
                 servers,
                 partition_key=None,
                 timeout=3,
                 allow_time_travel=False,
                 checkpoint=0,
                 checkpoint_time=0,
                 max_drift=600,
                 mark_bad_timeout=60,
                 max_backend_tries=5):
        """
        The grouper client.

        Args:
            servers (list of clowncar.server.Server): available API servers
            partition_key (str): key to use for picking a server, None defaults
                to hostname
            timeout (int): connection and request sent to tornado's HTTPClient
            allow_time_travel (bool): allow checkpoint[_time] to go backwards
                in subsequent queries
            checkpoint (int): starting checkpoint
            checkpoint_time (float): starting checkpoint unix epoch time
            max_drift (int): how much time in seconds before we consider data
                from server to be stale and raise BackendMaxDriftError
            mark_bad_timeout (int): time in seconds to not use servers that
                have been marked as dead
            max_backend_tries (int): number of backend servers to try before
                giving up and raising a BackendConnectionError
        """

        self._lock = Lock()
        self.timeout = timeout
        self.backends = Backends(servers, partition_key)

        self.checkpoint = Checkpoint(checkpoint, checkpoint_time)

        self.allow_time_travel = allow_time_travel
        self.max_drift = max_drift
        self.mark_bad_timeout = mark_bad_timeout
        self.max_backend_tries = max_backend_tries

        self.users = Users(self, "users")
        self.groups = Groups(self, "groups")
        self.permissions = Permissions(self, "permissions")
        self.service_accounts = ServiceAccounts(self, "service_accounts")