From 93bae64d334446f38ca1eb2a7c87202f6fd0c490 Mon Sep 17 00:00:00 2001 From: Snoyark Date: Tue, 10 May 2022 14:07:09 -0700 Subject: [PATCH] change name suffix resolution to account for sub-second api calls --- src/smexperiments/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/smexperiments/_utils.py b/src/smexperiments/_utils.py index f2899c6..e096687 100644 --- a/src/smexperiments/_utils.py +++ b/src/smexperiments/_utils.py @@ -12,7 +12,7 @@ # language governing permissions and limitations under the License. import os import random -import time +from datetime import datetime import boto3 import botocore @@ -44,7 +44,7 @@ def boto_session(): def suffix(): """Generate a random string of length 4""" alph = "abcdefghijklmnopqrstuvwxyz" - return "-".join([time.strftime("%Y-%m-%d-%H%M%S"), "".join(random.sample(alph, 4))]) + return "-".join([datetime.utcnow().strftime("%Y-%m-%d-%H%M%S%f"), "".join(random.sample(alph, 4))]) def name(prefix):