Commit f87cb7a5 authored by Maiterth, Matthias's avatar Maiterth, Matthias
Browse files

Fixed telemetry plotting.

parent 34dd1f2d
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ def plot_jobs_gantt(*, ax=None, jobs, bars_are_node_sized):
        ax = plt.figure(figsize=(10, 4))
    # Submit_time and Wall_time
    submit_t = [x.submit_time for x in jobs]
    duration = [x.current_run_time if x.end_time else x.time_limit for x in jobs]
    duration = [x.end_time - x.start_time if x.end_time and x.start_time else x.time_limit for x in jobs]
    nodes_required = [x.nodes_required for x in jobs]

    colors = spaced_colors(len(jobs))
@@ -354,7 +354,7 @@ def plot_jobs_gantt(*, ax=None, jobs, bars_are_node_sized):
    # ax_b labels:
    ax.set_xlabel("time [hh:mm]")
    minx_s = min([x.submit_time for x in jobs])
    maxx_s = np.ceil(max([x.current_run_tim if x.end_time else x.time_limit for
    maxx_s = np.ceil(max([x.end_time - x.start_time if x.end_time and x.start_time else x.time_limit for
                          x in jobs]) + max([x.submit_time for x in jobs]))
    x_label_mins = [int(n) for n in np.arange(minx_s // 60, maxx_s // 60)]
    x_label_ticks = [n * 60 for n in x_label_mins[0::60]]
@@ -371,7 +371,7 @@ def plot_nodes_gantt(*, ax=None, jobs):
    if ax is None:
        ax = plt.figure(figsize=(10, 4))
    # Submit_time and Wall_time
    duration = [x.current_run_time if x.end_time else x.time_limit for x in jobs]
    duration = [x.end_time - x.start_time if x.end_time and x.start_time else x.time_limit for x in jobs]
    # nodes_required = [x['nodes_required'] for x in jobs]
    start_t = [x.start_time for x in jobs]
    nodeIDs = [x.scheduled_nodes for x in jobs]
@@ -584,7 +584,8 @@ def plot_torus3d(G, active_edges=None, max_edges=4000, save_path="net_torus3d.pn
    hosts = [n for n, d in G.nodes(data=True) if d["type"] == "host"]

    # --- Plot routers ---
    xs, ys, zs = [G.nodes[n]["x"] for n in routers], [G.nodes[n]["y"] for n in routers], [G.nodes[n]["z"] for n in routers]
    xs, ys, zs = [G.nodes[n]["x"] for n in routers], [G.nodes[n]["y"]
                                                      for n in routers], [G.nodes[n]["z"] for n in routers]
    ax.scatter(xs, ys, zs, c="orange", s=6, label="Routers", alpha=0.8)

    # --- Plot hosts ---
@@ -624,7 +625,6 @@ def plot_torus3d(G, active_edges=None, max_edges=4000, save_path="net_torus3d.pn
        plt.savefig(save_path, dpi=300)



if __name__ == "__main__":
    plotter = Plotter()
    # plotter.plot_history([1, 2, 3, 4])
+3 −3
Original line number Diff line number Diff line
@@ -352,12 +352,12 @@ def run_telemetry(args: TelemetryArgs):

    if args.plot:
        fig, ax = plt.subplots()
    if args.plot == "jobs":
    if "jobs" in args.plot:
        plot_jobs_gantt(ax=ax, jobs=jobs, bars_are_node_sized=args.gantt_nodes)
        ax.invert_yaxis()
    elif args.plot == "nodes":
    if "nodes" in args.plot:
        plot_nodes_gantt(ax=ax, jobs=jobs)
    elif args.plot == "network":
    if "network" in args.plot:
        if ntx_means and nrx_means:
            # combine into total per‐job traffic
            net_means = [tx + rx for tx, rx in zip(ntx_means, nrx_means)]