From cbead62f54f6c6edb69ca141d44da005220feccc Mon Sep 17 00:00:00 2001 From: Donny Winston Date: Thu, 2 Nov 2023 16:01:58 -0400 Subject: [PATCH] fix: de-duplicate metadata submission after one minute (#347) re-submission of "same" changes is a valid use case closes #340 --- nmdc_runtime/api/endpoints/util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nmdc_runtime/api/endpoints/util.py b/nmdc_runtime/api/endpoints/util.py index 65017f8c..1846083f 100644 --- a/nmdc_runtime/api/endpoints/util.py +++ b/nmdc_runtime/api/endpoints/util.py @@ -2,12 +2,14 @@ import os import re import tempfile +from datetime import datetime from functools import lru_cache from json import JSONDecodeError from pathlib import Path from time import time_ns from typing import List, Optional, Set, Tuple from urllib.parse import parse_qs, urlparse +from zoneinfo import ZoneInfo from bson import json_util from dagster import DagsterRunStatus @@ -442,7 +444,11 @@ def persist_content_and_get_drs_object( **drs_metadata_for( filepath, base={ - "description": description + f" (created by/for {username})", + "description": ( + description + + f" (created by/for {username}" + + f" at {datetime.now(tz=ZoneInfo('America/Los_Angeles')).isoformat(timespec='minutes')})" + ), "access_methods": [{"access_id": drs_id}], }, )