examples/bq_file_load_benchmark/generic_benchmark_tools/benchmark_result_util.py
def insert_results_row(self):
        """Gathers the results of a load job into a benchmark table.

        Waits until the stat of the BigQuery job is 'DONE'. Note that this may
        take several minutes. Once the job stat is done, the method calls an
        internal method to set the benchmark properties, and another to get
        a BigQuery row containing the benchmark properties.

        Returns:
            A dict representing a row to be inserted into BigQuery.

        """
        job_state = self.job.state
        i = 0
        while job_state != 'DONE':
            if i == 0:
                logging.info('Job {0:s} currently in state {1:s}'.format(
                    self.job.job_id,
                    job_state,
                ))
                logging.info(
                    'Waiting to gather results for job {0:s} until '
                    'data has been loaded.'.format(self.job.job_id))
                i += 1
            self.job = self.bq_client.get_job(self.job.job_id)
            job_state = self.job.state
        logging.info('Job {0:s} currently in state {1:s}'.format(
            self.job.job_id,
            job_state,
        ))
        logging.info('Gathering results for benchmark')
        self._set_generic_properties()

        results_table_dataset_ref = self.bq_client.dataset(
            self.results_dataset_id
        )
        results_table_ref = results_table_dataset_ref.table(
            self.results_table_name
        )
        results_table = self.bq_client.get_table(results_table_ref)
        logging.info('Inserting {0:s}'.format(str(self.results_dict)))
        insert_job = self.bq_client.insert_rows(
            results_table,
            [self.results_dict],
        )
        if len(insert_job) == 0:
            logging.info(('{0:s} Benchmark results for job {1:s} loaded '
                          'loaded successfully'.format(
                                self.benchmark_name,
                                self.job.job_id)
                          ))
        else:
            logging.error(insert_job)
Gathers the results of a load job into a benchmark table.

        Waits until the stat of the BigQuery job is 'DONE'. Note that this may
        take several minutes. Once the job stat is done, the method calls an
        internal method to set the benchmark properties, and another to get
        a BigQuery row containing the benchmark properties.

        Returns:
            A dict representing a row to be inserted into BigQuery.

        
Gathers the results of a load job into a benchmark table.
Waits until the stat of the BigQuery job is 'DONE'. Note that this may
take several minutes. Once the job stat is done, the method calls an
internal method to set the benchmark properties, and another to get
a BigQuery row containing the benchmark properties.
Gathers the results of a load job into a benchmark table . Waits until the stat of the BigQuery job is ' DONE ' . Note that this may take several minutes . Once the job stat is done the method calls an internal method to set the benchmark properties and another to get a BigQuery row containing the benchmark properties .
def insert_results_row(self):
        job_state = self.job.state
        i = 0
        while job_state != 'DONE':
            if i == 0:
                logging.info('Job {0:s} currently in state {1:s}'.format(
                    self.job.job_id,
                    job_state,
                ))
                logging.info(
                    'Waiting to gather results for job {0:s} until '
                    'data has been loaded.'.format(self.job.job_id))
                i += 1
            self.job = self.bq_client.get_job(self.job.job_id)
            job_state = self.job.state
        logging.info('Job {0:s} currently in state {1:s}'.format(
            self.job.job_id,
            job_state,
        ))
        logging.info('Gathering results for benchmark')
        self._set_generic_properties()
        results_table_dataset_ref = self.bq_client.dataset(
            self.results_dataset_id
        )
        results_table_ref = results_table_dataset_ref.table(
            self.results_table_name
        )
        results_table = self.bq_client.get_table(results_table_ref)
        logging.info('Inserting {0:s}'.format(str(self.results_dict)))
        insert_job = self.bq_client.insert_rows(
            results_table,
            [self.results_dict],
        )
        if len(insert_job) == 0:
            logging.info(('{0:s} Benchmark results for job {1:s} loaded '
                          'loaded successfully'.format(
                                self.benchmark_name,
                                self.job.job_id)
                          ))
        else:
            logging.error(insert_job)
def insert_results_row ( self ) : job_state = self . job . state i = 0 while job_state != 'DONE' : if i == 0 : logging . info ( 'Job {0:s} currently in state {1:s}' . format ( self . job . job_id , job_state , ) ) logging . info ( 'Waiting to gather results for job {0:s} until ' 'data has been loaded.' . format ( self . job . job_id ) ) i += 1 self . job = self . bq_client . get_job ( self . job . job_id ) job_state = self . job . state logging . info ( 'Job {0:s} currently in state {1:s}' . format ( self . job . job_id , job_state , ) ) logging . info ( 'Gathering results for benchmark' ) self . _set_generic_properties ( ) results_table_dataset_ref = self . bq_client . dataset ( self . results_dataset_id ) results_table_ref = results_table_dataset_ref . table ( self . results_table_name ) results_table = self . bq_client . get_table ( results_table_ref ) logging . info ( 'Inserting {0:s}' . format ( str ( self . results_dict ) ) ) insert_job = self . bq_client . insert_rows ( results_table , [ self . results_dict ] , ) if len ( insert_job ) == 0 : logging . info ( ( '{0:s} Benchmark results for job {1:s} loaded ' 'loaded successfully' . format ( self . benchmark_name , self . job . job_id ) ) ) else : logging . error ( insert_job )
Gathers the results of a load job into a benchmark table.
Gathers the results of a load job into a benchmark table .
"""Gathers the results of a load job into a benchmark table.

        Waits until the stat of the BigQuery job is 'DONE'. Note that this may
        take several minutes. Once the job stat is done, the method calls an
        internal method to set the benchmark properties, and another to get
        a BigQuery row containing the benchmark properties.

        Returns:
            A dict representing a row to be inserted into BigQuery.

        """
A dict representing a row to be inserted into BigQuery.
A dict representing a row to be inserted into BigQuery .
self