-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Step Functions: Support for Aliasing #12326
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
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 51m 50s ⏱️ - 2m 40s Results for commit 6f52c483. ± Comparison against base commit 288a34a. This pull request skips 3 and un-skips 15 tests.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Solid addition here adding alias support 🚀
Have left some comments. Mostly related to deletions since aliasing adds another layer onto the CRUD operations against our state machine store 😵💫
for alias in state_machine_revision.aliases: | ||
if alias.is_router_for(state_machine_version_arn=state_machine_version_arn): | ||
raise ConflictException( | ||
"Version to be deleted must not be referenced by an alias. " | ||
f"Current list of aliases referencing this version: [{alias.name}]" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not be constructing the exception message with multiple aliases?
) | ||
state_machine_revision.delete_version(state_machine_version_arn) | ||
|
||
state_machines.pop(state_machine_version.arn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state_machines.pop(state_machine_version.arn) | |
state_machines.pop(state_machine_version.arn, None) |
Probably unlikely but since we're not locking here, that means that if this state machine version has already been deleted, doing a pop
from a dictionary could result in aKeyError
. Maybe let's be defensive and allow for the None
case to be defaulted to.
if ( | ||
state_machine_revision := state_machines.get(state_machine_version.source_arn) | ||
) is None or not isinstance(state_machine_revision, StateMachineRevision): | ||
continue | ||
state_machine_revision.aliases.remove(alias) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When theStateMachineRevision
is retrieved from the store, this state_machine_revision.aliases.remove(alias)
will raise an exception. I noticed this being raised in test_base_lifecycle_create_update_describe
.
Perhaps rather use the idempotent discard
which wont raise an exception when trying to delete a non-existent key from a set:
if ( | |
state_machine_revision := state_machines.get(state_machine_version.source_arn) | |
) is None or not isinstance(state_machine_revision, StateMachineRevision): | |
continue | |
state_machine_revision.aliases.remove(alias) | |
if ( | |
state_machine_revision := state_machines.get(state_machine_version.source_arn) | |
) is None or not isinstance(state_machine_revision, StateMachineRevision): | |
continue | |
state_machine_revision.aliases.discard(alias) |
Motivation
These changes introduce initial support for AWS Step Functions aliasing features.
Future work on aliasing: CloudFormation support; paging in ListStateMachineAliases
Changes
Testing