import logging


def parse_final_performance(stdout_file):
    """ Parses the Jfin of the clip from the stdout.txt of the job's run. """
    with open(stdout_file, 'r') as f:
        for line in f.readlines():
            if 'Optimization Pass Complete: Jini=' in line:
                s = line.split()[-3]
                return float(s.split("=")[-1])
    logging.warning(f"Unable to identify Jfin in: {stdout_file}")
    return 0.