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
diff --git a/tools/stats/upload_stats_lib.py b/tools/stats/upload_stats_lib.py
index 967aa3b..2a8ad81 100644
--- a/tools/stats/upload_stats_lib.py
+++ b/tools/stats/upload_stats_lib.py
@@ -4,6 +4,8 @@
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 @@
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)