#NEWLINE# def get_test_run_time_series( test_id , session = None ) : #NEWLINE# #INDENT# "Returns a time series dict of run_times for successes of a single test\n\n    :param str test_id: The test's uuid (the id column in the test table) which\n                        will be used to get all the test run times for.\n    :param session: optional session object if one isn't provided a new session\n\n    :return dict: A dictionary with the start times as the keys and the values\n                  being the duration of the test that started at that time in\n                  sec.\n    " #NEWLINE# session = ( session or get_session ( ) ) #NEWLINE# query = db_utils . model_query ( models . TestRun , session = session ) . filter_by ( test_id = test_id ) . filter_by ( status = 'success' ) . values ( models . TestRun . start_time , models . TestRun . start_time_microsecond , models . TestRun . stop_time , models . TestRun . stop_time_microsecond ) #NEWLINE# time_series = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for test_run in query : #NEWLINE# #INDENT# start_time = test_run [ 0 ] #NEWLINE# start_time = start_time . replace ( microsecond = test_run [ 1 ] ) #NEWLINE# stop_time = test_run [ 2 ] #NEWLINE# stop_time = stop_time . replace ( microsecond = test_run [ 3 ] ) #NEWLINE# time_series [ test_run [ 0 ] ] = ( stop_time - start_time ) . total_seconds ( ) #NEWLINE# #UNINDENT# return time_series