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

Added queue and running stats to more easily identify submission regions of interest.

parent 554d8ea1
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ from raps.workload import Workload
from raps.account import Accounts
from raps.weather import Weather
from raps.utils import create_casename, convert_to_seconds, write_dict_to_file, next_arrival
from raps.stats import get_engine_stats, get_job_stats
from raps.stats import get_engine_stats, get_job_stats, get_scheduler_stats

config = ConfigManager(system_name=args.system).get_config()

@@ -176,14 +176,17 @@ layout_manager.run(jobs, timestep_start=timestep_start, timestep_end=timestep_en

engine_stats = get_engine_stats(sc)
job_stats = get_job_stats(sc)
scheduler_stats = get_scheduler_stats(sc)
# Following b/c we get the following error when we use PM100 telemetry dataset
# TypeError: Object of type int64 is not JSON serializable
try:
    print(json.dumps(engine_stats, indent=4))
    print(json.dumps(job_stats, indent=4))
    print(json.dumps(scheduler_stats, indent=4))
except:
    print(engine_stats)
    print(job_stats)
    print(scheduler_stats)


if args.plot:
@@ -259,6 +262,11 @@ if args.output:
        job_history = pd.DataFrame(sc.get_job_history_dict())
        job_history.to_csv(OPATH / "job_history.csv", index=False)

        scheduler_running_history = pd.DataFrame(sc.get_scheduler_running_history())
        job_history.to_csv(OPATH / "running_history.csv", index=False)
        scheduler_queue_history = pd.DataFrame(sc.get_scheduler_running_history())
        job_history.to_csv(OPATH / "queue_history.csv", index=False)

        try:
            with open(OPATH / 'stats.out', 'w') as f:
                json.dump(engine_stats, f, indent=4)
+11 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ class Engine:
        self.output = kwargs.get('output')
        self.replay = kwargs.get('replay')
        self.sys_util_history = []
        self.scheduler_queue_history = []
        self.scheduler_running_history = []

        # Get scheduler type from command-line args or default
        scheduler_type = kwargs.get('scheduler', 'default')
@@ -230,6 +232,9 @@ class Engine:
        system_util = self.num_active_nodes / self.config['AVAILABLE_NODES'] * 100
        self.sys_util_history.append((self.current_time, system_util))

        self.scheduler_queue_history.append(len(self.running))
        self.scheduler_running_history.append(len(self.queue))

        # Render the updated layout
        power_df = None
        cooling_inputs, cooling_outputs = None, None
@@ -349,3 +354,9 @@ class Engine:

    def get_job_history_dict(self):
        return self.job_history_dict

    def get_scheduler_queue_history(self):
        return self.scheduler_queue_history

    def get_scheduler_running_history(self):
        return self.scheduler_running_history
+10 −0
Original line number Diff line number Diff line
@@ -50,6 +50,16 @@ def min_max_sum(value,min,max,sum):
    sum += value
    return min,max,sum


def get_scheduler_stats(engine: Engine):
    average_queue = sum(engine.scheduler_queue_history) / len(engine.scheduler_queue_history)
    average_running = sum(engine.scheduler_running_history) / len(engine.scheduler_running_history)
    stats = {
        'average_queue': average_queue,
        'average_running': average_running,
    }
    return stats

def get_job_stats(engine: Engine):
    """ Return job statistics processed over the engine execution"""
    # Information on Job-Mix