Commit 2d499a8b authored by Brewer, Wes's avatar Brewer, Wes
Browse files

Dump output of scheduler history at end of simulation for validation

parent 0c17a3b7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -155,6 +155,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
@@ -99,6 +99,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):
@@ -150,6 +151,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)
@@ -373,6 +375,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)