'Get test execution details for this job.
:return: Dictionary with test execution details'

def get_execution_details(self):

    def _find_framework_tests(rows):
        "\n                                                Here    we    are    looking    for    tests    such    as    SERVER_JOB    and    CLIENT_JOB.*\n                                                Those    are    autotest    'internal    job'    tests,    so    they    should    not    be\n                                                counted    when    evaluating    the    test    stats.\n\n                                                :param    rows:    List    of    rows    (matrix)    with    database    results.\n                                                "
        job_test_pattern = re.compile('SERVER|CLIENT\\_JOB\\.[\\d]')
        test_jobs = []
        for r in rows:
            test_name = r[0]
            if job_test_pattern.match(test_name):
                test_jobs.append(test_name)
        return test_jobs
    def _format_rows(rows, max_length=75):
        '\n                                                Format    failure    rows,    so    they    are    legible    on    the    resulting    email.\n\n                                                :param    rows:    List    of    rows    (matrix)    with    database    results.\n                                                :param    field:    Field    of    the    stats    dict    we    want    to    fill.\n                                                :param    max_length:    Int    with    maximum    length    of    a    line    printed.\n                                                '
        formatted_row = ''
        status_translate = {'GOOD': 'PASS', 'TEST_NA': 'SKIP'}
        if rows:
            label = rows[0][1]
            if (label in status_translate.keys()):
                label = status_translate[label]
            formatted_row += ('%s    (%s):\n' % (label, len(rows)))
            for row in rows:
                formatted_row += ('        %s\n' % row[0])
                if row[2]:
                    reason = row[2].split()
                    curr_length = 0
                    formatted_row += '                '
                    for word in reason:
                        previous_length = curr_length
                        curr_length += len(word)
                        if (curr_length > max_length):
                            curr_length = 0
                            if (previous_length != 0):
                                formatted_row += ('\n                %s    ' % word)
                            else:
                                formatted_row += ('%s\n                ' % word)
                        else:
                            formatted_row += ('%s    ' % word)
                    formatted_row += '\n'
            formatted_row += '\n'
        return formatted_row
    def _get_test_keyval(jobid, keyname, db, default=''):
        try:
            lines = []
            idx = db.execute(('SELECT    job_idx    FROM    tko_jobs    WHERE    afe_job_id=%s' % jobid))[0]
            test_indexes = db.execute(('SELECT    test_idx    FROM    tko_tests    WHERE    job_idx=%s' % idx))
            for i in test_indexes:
                rows = db.execute(('SELECT    value    FROM    tko_test_attributes    WHERE    test_idx=%s    AND    attribute="%s"' % (i[0], keyname)))
                if rows:
                    for row in rows:
                        line = []
                        for c in row:
                            line.append(str(c))
                        lines.append('    '.join(line))
            if lines:
                return lines[0]
            else:
                return default
        except:
            return default
    stats = {}
    rows = _db.execute(('\n                                                                SELECT    t.test,    s.word,    t.reason\n                                                                FROM    tko_tests    AS    t,    tko_jobs    AS    j,    tko_status    AS    s\n                                                                WHERE    t.job_idx    =    j.job_idx\n                                                                AND    s.status_idx    =    t.status\n                                                                AND    j.afe_job_id    =    %s\n                                                                ' % self.id))
    framework_tests = _find_framework_tests(rows)
    failed_rows = [r for r in rows if (r[1] != 'GOOD')]
    framework_tests_failed = _find_framework_tests(failed_rows)
    explicitly_failed_rows = [r for r in rows if (r[1] == 'FAIL')]
    warn_rows = [r for r in rows if (r[1] == 'WARN')]
    skipped_rows = [(r[0], r[1], '') for r in rows if (r[1] == 'TEST_NA')]
    passed_rows = [(r[0], r[1], '') for r in rows if ((r[1] == 'GOOD') and (r[0] not in framework_tests))]
    total_executed = (len(rows) - len(framework_tests))
    total_failed = (len(failed_rows) - len(framework_tests_failed))
    total_skipped = len(skipped_rows)
    if (total_executed > 0):
        success_rate = (100 - ((total_failed / float(total_executed)) * 100))
    else:
        success_rate = 0
    stats['total_executed'] = total_executed
    stats['total_failed'] = total_failed
    stats['total_passed'] = (total_executed - total_failed)
    stats['total_skipped'] = total_skipped
    stats['success_rate'] = success_rate
    stats['fail_detail'] = _format_rows(explicitly_failed_rows)
    stats['warn_detail'] = _format_rows(warn_rows)
    stats['skip_detail'] = _format_rows(skipped_rows)
    stats['pass_detail'] = _format_rows(passed_rows)
    time_row = _db.execute(('\n                                                                            SELECT    started_time,    finished_time\n                                                                            FROM    tko_jobs\n                                                                            WHERE    afe_job_id    =    %s\n                                                                            ' % self.id))
    if time_row:
        (t_begin, t_end) = time_row[0]
        try:
            delta = (t_end - t_begin)
            (minutes, seconds) = divmod(delta.seconds, 60)
            (hours, minutes) = divmod(minutes, 60)
            stats['execution_time'] = ('%02d:%02d:%02d' % (hours, minutes, seconds))
        except TypeError:
            stats['execution_time'] = '(could    not    determine)'
    else:
        stats['execution_time'] = '(none)'
    keyval_dict_list = []
    keyval_list = self.get_keyval_list()
    print ('DBG:    kv    list    obtained    from    get_keyval_list:    %s' % keyval_list)
    if keyval_list:
        for kv in keyval_list:
            keyval_dict = {}
            keyval_dict[kv] = _get_test_keyval(self.id, kv, _db)
            keyval_dict_list.append(keyval_dict)
    stats['keyval_dict_list'] = keyval_dict_list
    return stats
