Skip to content

Commit

Permalink
Replace random string generation with string_utils.random_str
Browse files Browse the repository at this point in the history
  • Loading branch information
christianversloot committed Apr 25, 2023
1 parent 98ca3f1 commit 4e1fe24
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# permissions and limitations under the License.
"""Implementation of the Sagemaker Step Operator."""

import random
import string
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Type, cast

import sagemaker
Expand All @@ -29,6 +27,7 @@
from zenml.logger import get_logger
from zenml.stack import Stack, StackValidator
from zenml.step_operators import BaseStepOperator
from zenml.utils.string_utils import random_str

if TYPE_CHECKING:
from zenml.config.base_settings import BaseSettings
Expand Down Expand Up @@ -185,7 +184,7 @@ def launch(
# SageMaker allows 63 characters at maximum for job name - ZenML uses 60 for safety margin.
step_name = Client().get_run_step(info.step_run_id).name
training_job_name = f"{info.pipeline.name}-{step_name}"[:55]
suffix = "".join(random.choices(string.ascii_lowercase, k=4))
suffix = random_str(4)
unique_training_job_name = f"{training_job_name}-{suffix}"

# Sagemaker doesn't allow any underscores in job/experiment/trial names
Expand Down

0 comments on commit 4e1fe24

Please sign in to comment.