<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Startup stuff, sourced from startup.ipy
Step1:  List RunSessions, ordered by descending timestamp
Step2:  Print latest RunSession
Step3:  We have overridden the __repr__ function in the base class for SqlAlchemy tables to print out the type, a dictionary of contents, and a list of relations.
Let's print out all build executions
Step4:  Not much information here. Let's print out information on the builds associated with the build executions
Step5:  Not very readable. Let's use prettyprint
Step6:  Better, but not good. The overridden repr implementation is supposed to be evalable. Note that we need to import datetime and call repr explicitly. Let's try
Step7:  Much better. We can see the 0hash and icepole implementations succeeded but the 0hash implementation failed. The log is mostly empty since we've rebuilt and thus there's not much makefile output. 
We want to know why the aesgcm implementations failed. To do this, we must examine the runs relation.
Step8:  Too much stuff. Let's clean it up
<ASSISTANT_TASK:>
Python Code:
# %load startup.ipy
#! /usr/bin/env python3
import sys
sys.path.append('./python')
import logging.config
import os
import xbx.database as xbxdb
import xbx.util as xbxu
import xbx.config as xbxc
import xbx.build as xbxb
import xbx.run as xbxr
logging.config.fileConfig("logging.ini", disable_existing_loggers=False)
CONFIG_PATH="config.ini"
xbxdb.init(xbxu.get_db_path(CONFIG_PATH))
config = xbxc.Config(CONFIG_PATH)
dbsession = xbxdb.scoped_session()
Explanation: Startup stuff, sourced from startup.ipy
End of explanation
s=dbsession
l = s.query(xbxr.RunSession).order_by(xbxr.RunSession.timestamp.desc())
print([i.timestamp for i in l])
Explanation: List RunSessions, ordered by descending timestamp
End of explanation
rs=l.first()
print(rs)
Explanation: Print latest RunSession
End of explanation
print([i for i in rs.build_execs])
Explanation: We have overridden the __repr__ function in the base class for SqlAlchemy tables to print out the type, a dictionary of contents, and a list of relations.
Let's print out all build executions:
End of explanation
print([(i, i.build) for i in rs.build_execs])
Explanation: Not much information here. Let's print out information on the builds associated with the build executions:
End of explanation
import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint([(i, i.build) for i in rs.build_execs])
Explanation: Not very readable. Let's use prettyprint:
End of explanation
import datetime
pp.pprint([(eval(repr(i)), eval(repr(i.build))) for i in rs.build_execs])
Explanation: Better, but not good. The overridden repr implementation is supposed to be evalable. Note that we need to import datetime and call repr explicitly. Let's try:
End of explanation
import datetime
for i in rs.build_execs:
    if not i.test_ok:
        for j in i.runs:
            print(j)
Explanation: Much better. We can see the 0hash and icepole implementations succeeded but the 0hash implementation failed. The log is mostly empty since we've rebuilt and thus there's not much makefile output. 
We want to know why the aesgcm implementations failed. To do this, we must examine the runs relation.
End of explanation
import datetime
for i in rs.build_execs:
    if not i.test_ok:
        for j in i.runs:
            print('{}: {}'.format(i.build.buildid,j.checksumfail_cause))
Explanation: Too much stuff. Let's clean it up:
End of explanation
<END_TASK>