Skip to content

#using uuid to randomize, otherwise system timestamp is used #3046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sagemaker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import time
import json
import abc
import uuid
from datetime import datetime

import botocore
Expand Down Expand Up @@ -81,6 +82,7 @@ def name_from_base(base, max_length=63, short=False):

def unique_name_from_base(base, max_length=63):
"""Placeholder Docstring"""
random.seed(int(uuid.uuid4())) # using uuid to randomize, otherwise system timestamp is used.
unique = "%04x" % random.randrange(16**4) # 4-digit hex
ts = str(int(time.time()))
available_length = max_length - 2 - len(ts) - len(unique)
Expand Down