Set the epoch timestamp when uploading data to dynamoDB (#130273)

This is to move away the `_event_time` field from Rockset, which we cannot use when reimport the data
Pull Request resolved: https://github.com/pytorch/pytorch/pull/130273
Approved by: https://github.com/clee2000
This commit is contained in:
Huy Do
2024-07-08 22:58:32 +00:00
committed by PyTorch MergeBot
parent b4cc25f126
commit 60d9f3f7d9

View File

@ -4,6 +4,8 @@ import gzip
import io
import json
import os
import time
import zipfile
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
@ -153,6 +155,9 @@ def upload_to_dynamodb(
for doc in docs:
if generate_partition_key:
doc["dynamoKey"] = generate_partition_key(repo, doc)
# This is to move away the _event_time field from Rockset, which we cannot use when
# reimport the data
doc["timestamp"] = int(round(time.time() * 1000))
batch.put_item(Item=doc)