schrodinger.seam.logapi module

API for inspecting log files from a Beam pipeline executed with the SeamRunner.

Example usage:

from schrodinger.seam.logapi import LogInspector
log_inspector = LogInspector('/path/to/seam_dir')
transform_names = log_inspector.getTransformNames()
counts = log_inspector.getCountsPerTransform('MyTransform')
events = log_inspector.getTransformLogEvents('MyTransform', only_level=logging.ERROR)
class schrodinger.seam.logapi.LogInspector(seam_dir: str | pathlib.Path)

Bases: object

LOG_PAGE_SIZE = 500
__init__(seam_dir: str | pathlib.Path)
getTransformNames() set[str]

Get the names of all transforms, both parent and leaf transforms.

getCountsPerTransform(transform_name: str = '') Counter

Get the counts of log messages per log level for a given transform.

Parameters:

transform_name – The name of a transform to get counts for. If not specified, counts for all transforms will be returned.

Returns:

A Counter mapping log levels to counts.

getRunnerLogEvents(only_level: Optional[int] = None, max_level: Optional[int] = None, page: int = 0) list[dict]

Get log events generated by the Beam runner itself, not by user transforms, for a given page.

If max_level is specified, only events with a level less than or equal to max_level will be returned. If only_level is specified, only events with that exact level will be returned. If max_level is not specified, it defaults to logging.DEBUG. If only_level is not specified, all levels will be returned.

getRunnerLogLevelCounts() Counter

Get the counts of log messages per log level for logs generated by the SeamRunner.

getTransformLogEvents(transform_name: str = '', only_level: Optional[int] = None, max_level: Optional[int] = None, page=0) list[dict]

Get log events for a specific transform, optionally filtered by log level for a given page.

If max_level is specified, only events with a level less than or equal to max_level will be returned. If only_level is specified, only events with that exact level will be returned. If max_level is not specified, it defaults to logging.DEBUG. If only_level is not specified, all levels will be returned. If transform_name is not specified, events for all transforms will be returned.

getContextualLogEvents(log_event: dict, transform_name: str = '', max_level: Optional[int] = None, only_level: Optional[int] = None) list[dict]

Get log events surrounding a specific log event for a given transform.

See getTransformLogEvents for details on the parameters.