schrodinger.seam.metricapi module

API for inspecting execution metrics from a Beam pipeline executed with the SeamRunner.

class schrodinger.seam.metricapi.WalltimeMetrics(walltime_per_stage: Dict[str, float])

Bases: object

Metrics related to walltime (elapsed time) for pipeline execution.

Attributes:

total_walltime_hours: Total walltime for the entire pipeline in hours walltime_per_stage: Dictionary mapping stage names to their walltime in hours

total_walltime_hours: float
walltime_per_stage: Dict[str, float]
__init__(walltime_per_stage: Dict[str, float]) → None
class schrodinger.seam.metricapi.SeamDirMetrics(final_seam_dir_gb: float, size_per_stage: Dict[str, float])

Bases: object

Metrics related to SeamDir size during pipeline execution.

Attributes:

peak_seam_dir_gb: Maximum size reached by SeamDir in gigabytes peak_stage: Name of the stage where peak size was reached final_seam_dir_gb: Final size of SeamDir after pipeline completion in gigabytes size_per_stage: Dictionary mapping stage names to their SeamDir size in gigabytes

peak_seam_dir_gb: float
peak_stage: str
final_seam_dir_gb: float
size_per_stage: Dict[str, float]
__init__(final_seam_dir_gb: float, size_per_stage: Dict[str, float]) → None
class schrodinger.seam.metricapi.ComputeTimes(compute_time_per_stage: Dict[str, float], compute_time_per_transform: Dict[str, float])

Bases: object

Metrics related to compute time (CPU or GPU) for pipeline execution.

Attributes:

compute_time_hours: Total compute time consumed by the entire pipeline in hours compute_time_per_stage: Dictionary mapping stage names to their compute time in hours compute_time_per_transform: Dictionary mapping transform names to their compute time in hours

compute_time_hours: float
compute_time_per_stage: Dict[str, float]
compute_time_per_transform: Dict[str, float]
__init__(compute_time_per_stage: Dict[str, float], compute_time_per_transform: Dict[str, float]) → None
class schrodinger.seam.metricapi.ComputeMetrics(cpu_metrics: ComputeTimes, gpu_metrics: ComputeTimes)

Bases: object

Metrics related to compute times (CPU and GPU) for pipeline execution.

Attributes:

total_compute_time_hours: Total compute time for the entire pipeline in hours cpu_metrics: CPU compute metrics gpu_metrics: GPU compute metrics

total_compute_time_hours: float
cpu_metrics: ComputeTimes
gpu_metrics: ComputeTimes
__init__(cpu_metrics: ComputeTimes, gpu_metrics: ComputeTimes) → None
class schrodinger.seam.metricapi.ResourceMetrics(peak_memory_mb: Optional[float], peak_cpu_load_percent: Optional[float], peak_active_workers: int = 0)

Bases: object

Metrics related to resource usage (memory and cpu) and active workers during pipeline execution.

Attributes:

peak_active_workers: Maximum number of active workers at any point in time peak_memory_mb: Maximum memory usage across all workers in megabytes, None if no data available peak_cpu_load_percent: Maximum CPU load percentage across all workers, None if no data available

peak_memory_mb: Optional[float]
peak_cpu_load_percent: Optional[float]
peak_active_workers: int = 0
__init__(peak_memory_mb: Optional[float], peak_cpu_load_percent: Optional[float], peak_active_workers: int = 0) → None
class schrodinger.seam.metricapi.WorkerResourceMetricEntry(memory_mb: float, cpu_percent: float, timestamp: str)

Bases: object

A single metric entry for a worker at a specific timestamp.

Attributes:

memory_mb: Memory usage in megabytes cpu_percent: CPU load percentage timestamp: Timestamp of the metric entry in “YYYY-MM-DD-HH:MM:SS” format

memory_mb: float
cpu_percent: float
timestamp: str
__init__(memory_mb: float, cpu_percent: float, timestamp: str) → None
class schrodinger.seam.metricapi.WorkerResourceMetrics(worker_id: str, metric_entries: List[WorkerResourceMetricEntry])

Bases: object

Metrics related to a specific worker’s resource usage.

Attributes:

worker_id: ID of the worker metric_entries: List of WorkerResourceMetricEntry objects representing resource usage over time peak_memory_mb: Peak memory usage in megabytes, None if no data available peak_cpu_load_percent: Peak CPU load percentage, None if no data available

worker_id: str
metric_entries: List[WorkerResourceMetricEntry]
peak_memory_mb: Optional[float] = None
peak_cpu_load_percent: Optional[float] = None
__init__(worker_id: str, metric_entries: List[WorkerResourceMetricEntry]) → None
class schrodinger.seam.metricapi.MetricsInspector(seam_dir: Union[str, Path])

Bases: object

This class provides methods to extract execution metrics from a beam pipeline run executed with SeamRunner.

Example usage:
>>> from schrodinger.seam.metricapi import MetricsInspector
>>> inspector = MetricsInspector("path/to/seam")
>>> compute_metrics = inspector.getComputeMetrics()
>>> print(f"Total cpu time: {compute_metrics.cpu_metrics.compute_time_hours} hours")
__init__(seam_dir: Union[str, Path])

Initialize the MetricsInspector from a seam directory.

property worker_ids: List[str]

Get a list of all worker IDs that reported cpu/memory metrics.

getWalltimeMetrics() → WalltimeMetrics

Get walltime metrics for the pipeline execution.

getSeamDirMetrics() → SeamDirMetrics

Get seam directory size metrics for the pipeline execution.

getComputeMetrics() → ComputeMetrics

Get Compute (CPU and GPU) metrics for the pipeline execution.

getResourceMetrics() → ResourceMetrics

Get resource usage (memory and cpu) metrics for the pipeline execution across all workers.

getWorkerResourceMetrics(worker_id) → WorkerResourceMetrics

Get resource usage (memory and cpu) metrics for a specific worker.