11"""Upload a batch of inferences to the Openlayer platform."""
22
33import os
4+ import time
5+ import shutil
46import tarfile
57import tempfile
6- import time
78from typing import Optional
89
910import httpx
1011import pandas as pd
1112
13+ from . import StorageType , _upload
14+ from .. import utils
1215from ... import Openlayer
1316from ..._utils import maybe_transform
1417from ...types .inference_pipelines import data_stream_params
15- from .. import utils
16- from . import StorageType , _upload
1718
1819
1920def upload_batch_inferences (
@@ -41,11 +42,11 @@ def upload_batch_inferences(
4142
4243 # Write dataset and config to temp directory
4344 with tempfile .TemporaryDirectory () as tmp_dir :
45+ temp_file_path = f"{ tmp_dir } /dataset.csv"
4446 if dataset_df is not None :
45- temp_file_path = f"{ tmp_dir } /dataset.csv"
4647 dataset_df .to_csv (temp_file_path , index = False )
4748 else :
48- temp_file_path = dataset_path
49+ shutil . copy ( dataset_path , temp_file_path )
4950
5051 # Copy relevant files to tmp dir
5152 config ["label" ] = "production"
@@ -56,11 +57,7 @@ def upload_batch_inferences(
5657
5758 tar_file_path = os .path .join (tmp_dir , object_name )
5859 with tarfile .open (tar_file_path , mode = "w:gz" ) as tar :
59- tar .add (temp_file_path , arcname = os .path .basename ("dataset.csv" ))
60- tar .add (
61- f"{ tmp_dir } /dataset_config.yaml" ,
62- arcname = os .path .basename ("dataset_config.yaml" ),
63- )
60+ tar .add (tmp_dir , arcname = os .path .basename ("monitoring_data" ))
6461
6562 # Upload to storage
6663 uploader .upload (
0 commit comments