@@ -10,23 +10,23 @@ import { getS3Client, getS3FilePath } from './utils/dataDumpUtils.js';
1010 * @param filePath file path to the metrics collection results, uses config.js by default
1111 */
1212export async function uploadMetricCollectionDataToS3 ( filePath = config . defaultMetricCollectionResultsFilePath ) {
13- console . log ( 'Creating S3 Client...' ) ;
14- const client = getS3Client ( ) ;
15- const formattedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
13+ try {
14+ console . log ( 'Creating S3 Client...' ) ;
15+ const client = getS3Client ( ) ;
16+ const formattedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
1617
17- console . log ( 'Loading metrics collection data from' , filePath ) ;
18- const metricsCollectionData = JSON . parse ( fs . readFileSync ( filePath , 'utf8' ) ) ;
19- const table = tableFromJSON ( metricsCollectionData ) ;
18+ console . log ( 'Loading metrics collection data from' , filePath ) ;
19+ const metricsCollectionData = JSON . parse ( fs . readFileSync ( filePath , 'utf8' ) ) ;
20+ const table = tableFromJSON ( metricsCollectionData ) ;
2021
21- console . log ( 'Getting S3 file path...' ) ;
22- const s3fileProps = getS3FilePath ( ) ;
23- const command = new PutObjectCommand ( {
24- Bucket : s3fileProps . bucketName ,
25- Key : path . join ( s3fileProps . key , formattedDate , 'metric-collection-results.parquet' ) ,
26- Body : tableToIPC ( table , 'stream' ) ,
27- } ) ;
22+ console . log ( 'Getting S3 file path...' ) ;
23+ const s3fileProps = getS3FilePath ( ) ;
24+ const command = new PutObjectCommand ( {
25+ Bucket : s3fileProps . bucketName ,
26+ Key : path . join ( s3fileProps . key , formattedDate , 'metric-collection-results.parquet' ) ,
27+ Body : tableToIPC ( table , 'stream' ) ,
28+ } ) ;
2829
29- try {
3030 console . log ( 'Dumping data to S3...' ) ;
3131 const response = await client . send ( command ) ;
3232 console . log ( response ) ;
0 commit comments