def _write_to_bigquery()

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


    def _write_to_bigquery(self, results: list[dict]):
        """Write resource usage results to BigQuery."""
        try:
            if self.project_id and results != []:
                client = bigquery.Client(self.project_id)
                destination_table = f"{self.project_id}.{self.dataset_id}.{self.table_id}"
                client.load_table_from_json(results, destination_table).result()
            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}")