Serve a JSON runs of an experiment, specified with query param
    `experiment`, with their nested data, tag, populated. Runs returned are
    ordered by started time (aka first event time) with empty times sorted last,
    and then ties are broken by sorting on the run name. Tags are sorted by
    its name, displayName, and lastly, inserted time.

def _serve_experiment_runs(self, request):
    """Serve a JSON runs of an experiment, specified with query param
    `experiment`, with their nested data, tag, populated. Runs returned are
    ordered by started time (aka first event time) with empty times sorted last,
    and then ties are broken by sorting on the run name. Tags are sorted by
    its name, displayName, and lastly, inserted time.
    """
    results = []
    if self._db_connection_provider:
      exp_id = request.args.get('experiment')
      runs_dict = collections.OrderedDict()

      db = self._db_connection_provider()
      cursor = db.execute('''
        SELECT
          Runs.run_id,
          Runs.run_name,
          Runs.started_time,
          Runs.started_time IS NULL as started_time_nulls_last,
          Tags.tag_id,
          Tags.tag_name,
          Tags.display_name,
          Tags.plugin_name,
          Tags.inserted_time
        From Runs
        LEFT JOIN Tags ON Runs.run_id = Tags.run_id
        WHERE Runs.experiment_id = ?
        AND (Tags.tag_id IS NULL OR Tags.plugin_name IS NOT NULL)
        ORDER BY started_time_nulls_last,
          Runs.started_time,
          Runs.run_name,
          Runs.run_id,
          Tags.tag_name,
          Tags.display_name,
          Tags.inserted_time;
      ''', (exp_id,))
      for row in cursor:
        run_id = row[0]
        if not run_id in runs_dict:
          runs_dict[run_id] = {
            "id": run_id,
            "name": row[1],
            "startTime": math.floor(row[2]),
            "tags": [],
          }
        # tag can be missing.
        if row[4]:
          runs_dict[run_id].get("tags").append({
            "id": row[4],
            "displayName": row[6],
            "name": row[5],
            "pluginName": row[7],
          })
      results = list(runs_dict.values())
    return http_util.Respond(request, results, 'application/json')