Skip to content

cmem_client.components.graphinsights.component¤

Corporate Memory Graph Insights component.

Graph Insights is an optional extension of Corporate Memory which computes statistics snapshots of graphs. This component covers the extension itself; the snapshots are the items of the GraphSnapshotsRepository returned by client.graph_snapshots.

The component is client.graphinsights. Until cmem-client 2.0.0, client.graph_insights still returns the snapshot repository it used to be, with a DeprecationWarning naming client.graph_snapshots.

Classes:

  • GraphInsights – High-level interface for the Corporate Memory Graph Insights extension.

GraphInsights¤

GraphInsights(client)

High-level interface for the Corporate Memory Graph Insights extension.

Graph Insights is optional, so check is_available() before using its snapshots through client.graph_snapshots.

Examples:

>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> client.graphinsights.is_available()

Functions:

  • get_health – Report version and health of the Graph Insights extension.
  • is_available – Tell whether the Graph Insights extension is active and the user may use it.

Attributes:

Parameters:

  • client (Client) – A configured Corporate Memory client instance with authentication and endpoint configuration.

get_health¤

get_health()

Report version and health of the Graph Insights extension.

An extension which is not available is reported as not applicable. Otherwise the version and health come from its /actuator/info and /actuator/health; a build of Graph Insights without these endpoints keeps version and health UNKNOWN and names the failing request in the error, instead of being reported DOWN.

Returns:

is_available¤

is_available()

Tell whether the Graph Insights extension is active and the user may use it.

Returns:

  • bool – True if the extension is active and the user is allowed to use it. False
  • bool – otherwise, including when the extension cannot be reached.

logger¤

logger = logging.getLogger(f'{self._client.logger.name}.{self.__class__.__name__}')

Comments