How to use the opentuner.resultsdb.models.DesiredResult.result_id.in_ function in opentuner

To help you get started, we’ve selected a few opentuner examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jansel / opentuner / opentuner / utils / stats_matplotlib.py View on Github external
no_data = None):
  '''
  return reduce(combine_fn, map(extract_fn, data)) for each quanta of the
  tuning run
  '''
  value_by_quanta = [ no_data ]
  start_date = run.start_date

  subq = (session.query(resultsdb.models.Result.id)
         .filter_by(tuning_run = run, was_new_best = True, state='OK'))

  q = (session.query(resultsdb.models.DesiredResult)
       .join(resultsdb.models.Result)
       .filter(resultsdb.models.DesiredResult.state=='COMPLETE',
               resultsdb.models.DesiredResult.tuning_run == run,
               resultsdb.models.DesiredResult.result_id.in_(subq.subquery()))
       .order_by(resultsdb.models.DesiredResult.request_date))

  first_id = None
  for dr in q:
    if first_id is None:
      first_id = dr.id
    td = (dr.request_date - start_date)
    duration = td.seconds + (td.days * 24 * 3600.0)
    # TODO: Make this variable configurable
    by_request_count = True
    stats_quanta = 10
    if by_request_count:
      quanta = dr.id - first_id
    else:
      quanta = int(duration / stats_quanta)
    while len(value_by_quanta) <= quanta:
github jansel / opentuner / opentuner / utils / stats_matplotlib.py View on Github external
no_data = None):
  """
  return reduce(combine_fn, map(extract_fn, data)) for each quanta of the
  tuning run
  """
  value_by_quanta = [ no_data ]
  start_date = run.start_date

  subq = (session.query(resultsdb.models.Result.id)
         .filter_by(tuning_run = run, was_new_best = True, state='OK'))

  q = (session.query(resultsdb.models.DesiredResult)
       .join(resultsdb.models.Result)
       .filter(resultsdb.models.DesiredResult.state=='COMPLETE',
               resultsdb.models.DesiredResult.tuning_run == run,
               resultsdb.models.DesiredResult.result_id.in_(subq.subquery()))
       .order_by(resultsdb.models.DesiredResult.request_date))

  first_id = None
  for dr in q:
    if first_id is None:
      first_id = dr.id
    td = (dr.request_date - start_date)
    duration = td.seconds + (td.days * 24 * 3600.0)
    # TODO: Make this variable configurable
    by_request_count = True
    stats_quanta = 10
    if by_request_count:
      quanta = dr.id - first_id
    else:
      quanta = int(old_div(duration, stats_quanta))
    while len(value_by_quanta) <= quanta: