def _write_to_bigquery()

in jetstream/diagnostics/resource_profiling_plugin.py [0:0]


    def _write_to_bigquery(self):
        """Write resource usage results to BigQuery."""
        try:
            if self.project_id and self.results != []:
                client = bigquery.Client(self.project_id)
                destination_table = f"{self.project_id}.{self.dataset_id}.{self.table_id}"
                client.load_table_from_json(self.results, destination_table).result()
                self.results = []
            elif self.project_id is None:
                print("ResourceProfilingPlugin not configured to write results to BigQuery.")
        except Exception as e:
            print(f"Exception while writing resource usage profiling data to BigQuery: {e}")