Skip to content
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

Fix: Adding hash to pipelines processing step function execution names to … #641

Merged
merged 3 commits into from
Jul 24, 2023
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import tempfile
from typing import Any, TypedDict
import yaml
import hashlib
sbkok marked this conversation as resolved.
Show resolved Hide resolved
from yaml.error import YAMLError

import boto3
Expand Down Expand Up @@ -173,9 +174,11 @@ def start_executions(
# AWS Step Functions supports max 80 characters.
# Since the run_id equals 49 characters plus the dash, we have 30
# characters available. To ensure we don't run over, lets use a
# truncated version instead:
truncated_pipeline_name = full_pipeline_name[:30]
sfn_execution_name = f"{truncated_pipeline_name}-{run_id}"
# truncated version concatenated with an hash generated from
# the pipeline name
truncated_pipeline_name = full_pipeline_name[:24]
execution_unique_hash = hashlib.md5( bytes(full_pipeline_name + run_id, 'utf-8') ).hexdigest()[:5]
sbkok marked this conversation as resolved.
Show resolved Hide resolved
sfn_execution_name = f"{truncated_pipeline_name}-{execution_unique_hash}-{run_id}"
sfn_client.start_execution(
stateMachineArn=PIPELINE_MANAGEMENT_STATEMACHINE,
name=sfn_execution_name,
Expand Down