We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66e6eae commit 056b0bdCopy full SHA for 056b0bd
google/cloud/aiplatform/utils/gcs_utils.py
@@ -18,6 +18,7 @@
18
import datetime
19
import glob
20
import logging
21
+import os
22
import pathlib
23
import tempfile
24
from typing import Optional, TYPE_CHECKING
@@ -317,8 +318,8 @@ def _upload_pandas_df_to_gcs(
317
318
ValueError: When a file format other than JSONL is provided.
319
"""
320
- with tempfile.NamedTemporaryFile() as temp_file:
321
- local_dataset_path = temp_file.name
+ with tempfile.TemporaryDirectory() as temp_dir:
322
+ local_dataset_path = os.path.join(temp_dir, "dataset.jsonl")
323
324
if file_format == "jsonl":
325
df.to_json(path_or_buf=local_dataset_path, orient="records", lines=True)
0 commit comments