OmniGraphInspector#

class omni.graph.core.OmniGraphInspector#

Bases: object

Provides simple interfaces for inspection of OmniGraph objects

Methods

__init__()

Import the inspection interface, logging a warning if it doesn't exist.

as_json(omnigraph_object[, file_path, flags])

Outputs the JSON format data belonging to the context (for debugging)

as_text(omnigraph_object[, file_path])

Returns the serialized data belonging to the context (for debugging)

attribute_locations(context)

Find all of the attribute data locations within Fabric for the given context.

available()

Returns true if the inspection capabilities are available

memory_use(omnigraph_object)

Returns the number of bytes of memory used by the object, if it supports it

__init__()#

Import the inspection interface, logging a warning if it doesn’t exist. This allows the functions to silently fail, while still providing an alert to the user as to why their inspection operations might not work as expected.

as_json(
omnigraph_object: Graph | GraphContext | GraphRegistry | NodeType,
file_path: str | None = None,
flags: List[str] | None = None,
) str#

Outputs the JSON format data belonging to the context (for debugging)

Parameters:
  • omnigraph_object – Object whose contents are to be inspected

  • file_path – If a string then dump the output to a file at that path, otherwise return a string with the dump

  • flags – Set of enabled flags on the inspection object. Valid values are: maps: Show all of the attribute type maps (lots of redundancy here, and independent of data present) noDataDetails: Hide the minutiae of where each attribute’s data is stored in Fabric

Returns:

If no file_path was specified then return the inspected data.

If a file_path was specified then return the path where the data was written (should be the same)

Return type:

str

Raises:

OmniGraphError – If the object type doesn’t support json inspection

as_text(
omnigraph_object: Graph | GraphContext | GraphRegistry | NodeType,
file_path: str | None = None,
) str#

Returns the serialized data belonging to the context (for debugging)

Parameters:
  • omnigraph_object – Object whose contents are to be inspected

  • file_path – If a string then dump the output to a file at that path, otherwise return a string with the dump

Returns:

If no file_path was specified then return the inspected data.

If a file_path was specified then return the path where the data was written (should be the same)

Return type:

str

Raises:

OmniGraphError – If the object type doesn’t support text inspection

attribute_locations(
context: GraphContext,
) Dict[str, Dict[str, int]]#

Find all of the attribute data locations within Fabric for the given context.

Parameters:

context – Graph context whose Fabric data is to be inspected

Returns:

{ attribute name : (attribute path, attribute location) }

Return type:

dict[str, dict[str,int]]

available() bool#

Returns true if the inspection capabilities are available

memory_use(
omnigraph_object: Graph | GraphContext | GraphRegistry | NodeType,
) int#

Returns the number of bytes of memory used by the object, if it supports it

Parameters:

omnigraph_object – Object whose memory use is to be inspected

Returns:

Number of bytes found to be used by the object passed in

Return type:

int

Raises:

OmniGraphError – If the object type doesn’t support memory inspection