Skip to content

Commit d16eee4

Browse files
author
Stainless Bot
committed
feat: fix: uploading batch data was broken
1 parent 3eed9ca commit d16eee4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/openlayer/lib/data/batch_inferences.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
"""Upload a batch of inferences to the Openlayer platform."""
22

33
import os
4+
import time
5+
import shutil
46
import tarfile
57
import tempfile
6-
import time
78
from typing import Optional
89

910
import httpx
1011
import pandas as pd
1112

13+
from . import StorageType, _upload
14+
from .. import utils
1215
from ... import Openlayer
1316
from ..._utils import maybe_transform
1417
from ...types.inference_pipelines import data_stream_params
15-
from .. import utils
16-
from . import StorageType, _upload
1718

1819

1920
def 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

Comments
 (0)