noc.core.dcs.base

Module Contents

class noc.core.dcs.base.DCSBase(url, ioloop=None)

Bases: object

DEFAULT_SERVICE_RESOLUTION_TIMEOUT
resolver_cls
HEALTH_OK_HTTP_CODE = 200
HEALTH_FAILED_HTTP_CODE = 429
parse_url(self, u)
start(self)

Run IOLoop if not started yet :return:

stop(self)

Stop IOLoop if not stopped yet :return:

register(self, name, address, port, pool=None, lock=None, tags=None)

Register service :param name: :param address: :param port: :param pool: :param lock: :param tags: List of extra tags :return:

kill(self)
acquire_slot(self, name, limit)

Acquire shard slot :param name: <service name>-<pool> :param limit: Configured limit :return: (slot number, number of instances)

get_resolver(self, name, critical=False, near=False)
resolve(self, name, hint=None, wait=True, timeout=None, full_result=False, critical=False, near=False)
expire_resolvers(self)
resolve_sync(self, name, hint=None, wait=True, timeout=None, full_result=False)

Returns hint when service is active or new service instance, :param name: :param hint: :param full_result: :return:

resolve_near(self, name, hint=None, wait=True, timeout=None, full_result=False, critical=False)

Synchronous call to resolve nearby service Commonly used for external services like databases :param name: Service name :return: address:port

get_status(self)
set_faulty_status(self, message)
clear_faulty_status(self)
class noc.core.dcs.base.ResolverBase(dcs, name, critical=False, near=False)

Bases: object

stop(self)
start(self)
set_services(self, services)

Update actual list of services :param services: dict of service_id -> <address>:<port> :return:

resolve(self, hint=None, wait=True, timeout=None, full_result=False)
policy_random(self)

Randomly select service :return:

policy_rr(self)

Round-robin selection of service :return: