Commit 648cdd8a authored by Maiterth, Matthias's avatar Maiterth, Matthias
Browse files

Merge remote-tracking branch 'origin/validate-scheduler' into incentive-structures2

parents dfe8b08d 2d499a8b
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -84,8 +84,8 @@ if args.replay:
        extracted_date = "Date not found"
        DIR_NAME = create_casename()

    # Read telemetry data
    if args.replay[0].endswith(".npz"): # read .npz file
    # Read telemetry data (either npz file or via custom data loader)
    if args.replay[0].endswith(".npz"): # replay .npz file
        print(f"Loading {args.replay[0]}...")
        jobs = td.load_snapshot(args.replay[0])

@@ -156,6 +156,12 @@ try:
except:
    print(output_stats)

# Schedule history
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
schedule_history = pd.DataFrame(sc.get_history())
print(schedule_history)

if args.plot:
    if 'power' in args.plot:
        pl = Plotter('Time (s)', 'Power (kW)', 'Power History', \
+5 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ class Scheduler:
        self.replay = kwargs.get('replay')
        self.policy = Policy(strategy=kwargs.get('schedule'))
        self.sys_util_history = []
        self.history = []


    def add_job(self, job):
@@ -152,6 +153,7 @@ class Scheduler:

                # Schedule job
                self.assign_nodes_to_job(job)
                self.history.append(dict(id=job.id, time=self.current_time, nodes=job.nodes_required, wall_time=job.wall_time))

                if self.debug:
                    scheduled_nodes = summarize_ranges(job.scheduled_nodes)
@@ -379,6 +381,9 @@ class Scheduler:
            if self.debug and timestep % self.config['UI_UPDATE_FREQ'] == 0:
                    print(".", end="", flush=True)

    def get_history(self):
        return self.history

    def get_stats(self):
        """ Return output statistics """
        sum_values = lambda values : sum(x[1] for x in values)