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(apiVersion=None, defaultPort=None, host=None, port=None, monitoring=None)[source]

Base luna-python-matcher context

attributesDBContext: RedisContext

attributes database context

eventsDBAdaptor: Optional[DBAdaptor]

events database adaptor

eventsDBContext: DBContext

events database context

facesDBAdaptor: Optional[DBAdaptor]

faces database adaptor

facesDBContext: DBContext

faces database context

redisClient: Optional[Redis]

redis client

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(apiVersion=None, defaultPort=None, host=None, port=None, monitoring=None)[source]

Python matcher application context

matcher: Optional[Matcher]

matcher

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(apiVersion=None, defaultPort=None, host=None, port=None, monitoring=None)[source]

Python matcher application context

dispatcher: Dispatcher

dispatcher for matching

luna3Session: Optional[Luna3Session]

luna3 client