Пример #1
0
def load_monitoring_data(directory: Path, cluster: Cluster) -> MonitoringData:
    data = {}

    for (node, process) in cluster.processes():
        if "monitor" == process.key:
            trace_file = node_monitoring_trace(directory, node.hostname)
            if trace_file.exists():
                with open(trace_file) as f:
                    data[node] = MonitoringRecord.deserialize_records(f)
            else:
                logging.warning(
                    f"Monitoring trace for {node.hostname} not found at {trace_file}"
                )
    return data
Пример #2
0
def load_profiling_data(cluster: Cluster) -> ProfilingData:
    data = {}

    for (_, process) in cluster.processes():
        if PROFILER_METADATA_KEY in process.metadata:
            records = process.metadata[PROFILER_METADATA_KEY]
            process_records = {}

            for (tag, file) in records.items():
                file = Path(file)
                if file.is_file():
                    process_records[tag] = file
                else:
                    logging.warning(
                        f"Profiler record `{tag}` for `{process.key}` not found at {file}"
                    )
            data[process.key] = process_records
    return data