@@ -1996,10 +1996,28 @@ def publish_batch_data(
19961996 batch_data , batch_df = self ._add_default_column (
19971997 config = batch_data , df = batch_df , column_name = column
19981998 )
1999+ # Get min and max timestamps
2000+ min_timestamp = batch_df [batch_data ["timestampColumnName" ]].min ()
2001+ max_timestamp = batch_df [batch_data ["timestampColumnName" ]].max ()
19992002
2000- # TODO: Make POST request to upload batch
2001- print ("Publishing batch of data..." )
2002- print (batch_data )
2003+ with tempfile .TemporaryDirectory () as tmp_dir :
2004+ # Copy relevant files to tmp dir
2005+ utils .write_yaml (batch_data , f"{ tmp_dir } /dataset_config.yaml" )
2006+ batch_df .to_csv (f"{ tmp_dir } /dataset.csv" , index = False )
2007+
2008+ tar_file_path = os .path .join (tmp_dir , "tarfile" )
2009+ with tarfile .open (tar_file_path , mode = "w:gz" ) as tar :
2010+ tar .add (tmp_dir , arcname = os .path .basename ("reference_dataset" ))
2011+
2012+ self .api .upload (
2013+ endpoint = f"inference-pipelines/{ inference_pipeline_id } /data" ,
2014+ file_path = tar_file_path ,
2015+ object_name = "tarfile" ,
2016+ body = {},
2017+ storage_uri_key = "storageUri" ,
2018+ method = "POST" ,
2019+ )
2020+ print ("Batch of data published!" )
20032021
20042022 def _add_default_column (
20052023 self , config : Dict [str , any ], df : pd .DataFrame , column_name : str
0 commit comments