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

student attempt at implementing termination of step function execution #1596

Closed
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
14 changes: 12 additions & 2 deletions metaflow/plugins/aws/step_functions/step_functions_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,18 @@ def list_executions(self, state_machine_arn, states):
)

def terminate_execution(self, state_machine_arn, execution_arn):
# TODO
pass
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still needs a counterpart in the step_functions_cli.py so the function can be called through the CLI. You can see how the command has been implemented in argo_workflows_cli.py for some example on the plumbing.

Another thing that needs to be implemented for this feature is a validate_run_id (again, similar to argo CLI) which checks that the run_id the user has provided belongs to the correct flow/project/user and has a matching token.
This is to guard against being able to issue arbitrary commands such as

python anyflow.py step-functions terminate not-my-run-id

# Use the AWS Step Functions client to stop the execution
response = self._client.stop_execution(
executionArn=execution_arn
)
return response
except self._client.exceptions.ExecutionDoesNotExist:
# Handle the case where the execution doesn't exist
raise ValueError(f"The execution ARN {execution_arn} does not exist.")
except Exception as e:
# Handle other potential errors
raise e

def _default_logging_configuration(self, log_execution_history):
if log_execution_history:
Expand Down