def upload_metric(self, dataset_name, table_name, run_id):
    """Upload metric information to Bigquery.

    Args:
      dataset_name: string, the name of bigquery dataset where the data will be
        uploaded.
      table_name: string, the name of bigquery table under the dataset where
        the metric data will be uploaded. This is different from the
        benchmark_run table.
      run_id: string, a unique ID that will be attached to the data, usually
        this is a UUID4 format. This should be the same as the benchmark run_id.
    """
    expected_file = os.path.join(
        self._logging_dir, logger.METRIC_LOG_FILE_NAME)
    with tf.gfile.GFile(expected_file) as f:
      lines = f.readlines()
      metrics = []
      for line in filter(lambda l: l.strip(), lines):
        metric = json.loads(line)
        metric["run_id"] = run_id
        metrics.append(metric)
      table_ref = self._bq_client.dataset(dataset_name).table(table_name)
      errors = self._bq_client.insert_rows_json(table_ref, metrics)
      if errors:
        tf.logging.error(
            "Failed to upload benchmark info to bigquery: {}".format(errors))
def upload_metric ( self , dataset_name , table_name , run_id ) : expected_file = os . path . join ( self . _logging_dir , logger . METRIC_LOG_FILE_NAME ) with tf . gfile . GFile ( expected_file ) as f : lines = f . readlines ( ) metrics = [ ] for line in filter ( lambda l : l . strip ( ) , lines ) : metric = json . loads ( line ) metric [ "run_id" ] = run_id metrics . append ( metric ) table_ref = self . _bq_client . dataset ( dataset_name ) . table ( table_name ) errors = self . _bq_client . insert_rows_json ( table_ref , metrics ) if errors : tf . logging . error ( "Failed to upload benchmark info to bigquery: {}" . format ( errors ) )
Upload metric information to Bigquery.

    Args:
      dataset_name: string, the name of bigquery dataset where the data will be
        uploaded.
      table_name: string, the name of bigquery table under the dataset where
        the metric data will be uploaded. This is different from the
        benchmark_run table.
      run_id: string, a unique ID that will be attached to the data, usually
        this is a UUID4 format. This should be the same as the benchmark run_id.