Base application context

Module contains base application and request class.

class luna_python_matcher.app_common.base_application.MatcherBaseApp(*args, **kwargs)[source]

Base service application

async static checkConnectionToAttributesDB(dbSettings)[source]

Check connections to temporary attributes db :param dbSettings: redis settings

Returns:

True, if check was passed successfully, else False.

Return type:

bool

async static checkConnectionToEventsDB(dbSettings)[source]

Check connections to events db :param dbSettings: database settings

Returns:

True, if check was passed successfully, else False.

Return type:

bool

async static checkConnectionToFacesDB(dbSettings)[source]

Check connections to faces db :param dbSettings: database settings

Returns:

True, if check was passed successfully, else False.

Return type:

bool

initContexts()[source]

Initialize faces, events and attributes databases context

Return type:

None

async initDBContext()[source]

Initialize faces & events database context.

async initRedisDB(redisDBSettings)[source]

Initialize Redis client. :param redisDBSettings: redis db settings

async initialize()[source]

Initialize application.

async shutdown()[source]

Shutdown application services.

class luna_python_matcher.app_common.base_application.MatcherBaseCtx[source]

Base luna-python-matcher context

apiVersion: int

service api version

attributesDBContext: RedisContext

attributes database context

cmdArgs: Namespace

command line arguments

configClass: BasePythonServiceSettingsClass

settings class

defaultPort: int

default port

eventsDBAdaptor: Optional[DBAdaptor]

events database adaptor

eventsDBContext: DBContext

events database context

facesDBAdaptor: Optional[DBAdaptor]

faces database adaptor

facesDBContext: DBContext

faces database context

host: str

service host

logger: Logger

global app logger

monitoring: LunaRequestInfluxMonitoring

service monitoring

pluginManager: PluginManager

plugin manager

port: int

service port

redisClient: Optional[Redis]

redis client

serviceConfig: PythonServiceSettingsClass

service config

Luna Python Matcher application context

Sanic application server.

class luna_python_matcher.app.app.PythonMatcherApp[source]

Python matcher application

getRuntimeChecks(includeLunaServices=False)[source]

Returns configured system checks, pairs of (name, coroutine).

Parameters:

includeLunaServices – A bool, whether to include checks for luna services.

Return type:

List[Tuple[str, Awaitable]]

async initialize()[source]

Initialize application.

initializeMatcher()[source]

Initialize matcher and matcherlib and pass reference to the matcher to clients.

It’s important to configure logging first.

async shutdown()[source]

Shutdown application services.

class luna_python_matcher.app.app.PythonMatcherCtx[source]

Python matcher application context

apiVersion: int

service api version

attributesDBContext: AttributesDBContext

attributes database context

cmdArgs: Namespace

command line arguments

configClass: BasePythonServiceSettingsClass

settings class

defaultPort: int

default port

eventsDBAdaptor: Optional[DBAdaptor]

events database adaptor

eventsDBContext: EventsDBContext

events database context

facesDBAdaptor: Optional[DBAdaptor]

faces database adaptor

facesDBContext: FacesDBContext

faces database context

host: str

service host

logger: Logger

global app logger

matcher: Optional[Matcher]

matcher

monitoring: LunaRequestInfluxMonitoring

service monitoring

pluginManager: PluginManager

plugin manager

port: int

service port

redisClient: Optional[Redis]

redis client

serviceConfig: PythonServiceSettingsClass

service config

async luna_python_matcher.app.app.checkCachedMatcherProcess(app, loop)[source]

Check connection to Cached Matcher. Terminate Sanic process if connection check failed. :param app: python matcher application :param loop: event loop

Return type:

None

Luna Python Matcher Proxy application context

Application server.

class luna_python_matcher.app_proxy.app.PythonMatcherProxyApp[source]

Python matcher proxy application

getRuntimeChecks(includeLunaServices=False)[source]

Returns configured system checks, pairs of (name, coroutine).

Parameters:

includeLunaServices – A bool, whether to include checks for luna services.

Return type:

List[Tuple[str, Awaitable]]

initLunaClient(settings)[source]

Initialize session to internal services.

async initialize()[source]

Initialize application.

async shutdown()[source]

Shutdown application services.

class luna_python_matcher.app_proxy.app.PythonMatcherProxyCtx[source]

Python matcher application context

apiVersion: int

service api version

attributesDBContext: AttributesDBContext

attributes database context

cmdArgs: Namespace

command line arguments

configClass: BasePythonServiceSettingsClass

settings class

defaultPort: int

default port

dispatcher: Dispatcher

dispatcher for matching

eventsDBAdaptor: Optional[DBAdaptor]

events database adaptor

eventsDBContext: EventsDBContext

events database context

facesDBAdaptor: Optional[DBAdaptor]

faces database adaptor

facesDBContext: FacesDBContext

faces database context

host: str

service host

logger: Logger

global app logger

luna3Session: Optional[Luna3Session]

luna3 client

monitoring: LunaRequestInfluxMonitoring

service monitoring

pluginManager: PluginManager

plugin manager

port: int

service port

redisClient: Optional[Redis]

redis client

serviceConfig: PythonServiceSettingsClass

service config