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

attributesDBContext: db.context_attributes.RedisContext

attributes database context

eventsDBAdaptor: Optional[crutches_on_wheels.adaptors.adaptor.DBAdaptor]

events database adaptor

eventsDBContext: db.context_events.DBContext

events database context

facesDBAdaptor: Optional[crutches_on_wheels.adaptors.adaptor.DBAdaptor]

faces database adaptor

facesDBContext: db.context_faces.DBContext

faces database context

redisClient: Optional[aioredis.commands.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[source]

Python matcher application context

matcher: Optional[pymatcherlib.pymatcherlib.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

getQueueSettings(settings)[source]

Get queue settings for matcher-proxy. :param settings: settings

Returns

QueueSettings

Return type

QueueSettings

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

dispatcher: app_proxy.matcher.dispatcher.Dispatcher

dispatcher for matching

luna3Session: Optional[luna3.client.Luna3Session]

luna3 client