<s> from opentuner . resultsdb . models import * <EOL> class DriverBase ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , <EOL> session , <EOL> tuning_run , <EOL> objective , <EOL> tuning_run_main , <EOL> args , <EOL> ** kwargs ) : <EOL> self . args = args <EOL> self . objective = objective <EOL> self . session = session <EOL> self . tuning_run_main = tuning_run_main <EOL> self . tuning_run = tuning_run <EOL> self . program = tuning_run . program <EOL> def results_query ( self , <EOL> generation = None , <EOL> objective_ordered = False , <EOL> config = None ) : <EOL> q = self . session . query ( Result ) <EOL> q = q . filter_by ( tuning_run = self . tuning_run ) <EOL> if config : <EOL> q = q . filter_by ( configuration = config ) <EOL> if generation is not None : <EOL> subq = ( self . session . query ( DesiredResult . result_id ) <EOL> . filter_by ( tuning_run = self . tuning_run , <EOL> generation = generation ) ) <EOL> q = q . filter ( Result . id . in_ ( subq . subquery ( ) ) ) <EOL> if objective_ordered : <EOL> q = self . objective . result_order_by ( q ) <EOL> return q <EOL> def requests_query ( self ) : <EOL> q = self . session . query ( DesiredResult ) . filter_by ( tuning_run = self . tuning_run ) <EOL> return q </s>
