oio.conscience package

Submodules

oio.conscience.agent module

class oio.conscience.agent.ConscienceAgent(conf)[source]

Bases: oio.common.daemon.Daemon

init_watchers(services)[source]
load_services()[source]
run(*args, **kwargs)[source]
stop()[source]
stop_watchers()[source]
class oio.conscience.agent.ServiceWatcher(conf, service, **kwargs)[source]

Bases: object

check()[source]

Perform the registered checks on the service until any of them fails of the end of the list is reached.

get_stats()[source]

Update service definition with all configured stats

init_checkers(service)[source]
init_stats(service)[source]

Initialize service stat fetchers

register()[source]
start()[source]
stop()[source]
watch()[source]
oio.conscience.agent.load_modules(group_name)[source]

oio.conscience.client module

class oio.conscience.client.ConscienceClient(conf, **kwargs)[source]

Bases: oio.common.client.ProxyClient

Conscience client. Some calls are actually redirected to LbClient.

all_services(type_, full=False, **kwargs)[source]
flush(srv_type)[source]
info()[source]
local_services()[source]
lock_score(infos_srv)[source]
next_instance(pool)[source]

Get the next service instance from the specified pool

next_instances(pool, **kwargs)[source]

Get the next service instances from the specified pool.

Parameters:
  • size (int) – number of services to get
  • slot (str) – comma-separated list of slots to poll
poll(pool, **kwargs)[source]

Get a set of services from a predefined pool.

Parameters:
  • avoid (list) – service IDs that must be avoided
  • known (list) – service IDs that are already known
register(pool, service_definition, **kwargs)[source]
resolve(srv_type, service_id)[source]
service_types()[source]
unlock_score(infos_srv)[source]
class oio.conscience.client.LbClient(conf, **kwargs)[source]

Bases: oio.common.client.ProxyClient

Simple load balancer client

create_pool(pool, targets, options=None, **kwargs)[source]

Create a service pool on the local proxy.

Parameters:
  • pool (str) – a name for the pool
  • targets – a list of tuples like (1, “rawx-usa”, “rawx”, …)
  • options (dict) – options for the pool
Raises:

Conflict – if a pool with same name already exists

next_instance(pool)[source]

Get the next service instance from the specified pool

next_instances(pool, **kwargs)[source]

Get the next service instances from the specified pool.

Parameters:
  • size (int) – number of services to get
  • slot (str) – comma-separated list of slots to poll
poll(pool, **kwargs)[source]

Get a set of services from a predefined pool.

Parameters:
  • avoid (list) – service IDs that must be avoided
  • known (list) – service IDs that are already known

Module contents