def get_app_execution_time()

in src/hpcadvisor/batch_handler.py [0:0]


def get_app_execution_time(file_stdout):
    """Get application execution time from the stdout file
    Here we are looking for HPCADVISORVAR APPEXECTIME=100
    APPEXECTIME is the application execution time in seconds
    which is defined by the user
    """

    appexectime = 0
    with open(file_stdout, "r") as f:
        for line in f:
            if "HPCADVISORVAR" in line and "APPEXECTIME":
                line = line.strip()
                # TODO: improve space handling here
                line = line.replace("HPCADVISORVAR ", "")
                appexectime = float(line.split("=")[1])
                break

    return appexectime