-
Notifications
You must be signed in to change notification settings - Fork 703
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
[flyteadmin] add delete execution phase api #6267
base: master
Are you sure you want to change the base?
Changes from all commits
48c547a
739b16c
c452608
6fccc9b
7d5bef7
cd56698
63aad12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1959,3 +1959,37 @@ | |||||
} | ||||||
return filters, nil | ||||||
} | ||||||
func (m *ExecutionManager) DeleteExecutionPhase(ctx context.Context, req *admin.ExecutionPhaseDeleteRequest) (*admin.ExecutionPhaseDeleteResponse, error) { | ||||||
executionPhase := req.GetPhase() | ||||||
if executionPhase == core.WorkflowExecution_UNDEFINED { | ||||||
return nil, fmt.Errorf("execution phase cannot be undefined") | ||||||
} | ||||||
|
||||||
workflowExecutionID := req.GetId() | ||||||
if workflowExecutionID == nil { | ||||||
return nil, fmt.Errorf("workflow execution identifier cannot be nil") | ||||||
} | ||||||
|
||||||
if workflowExecutionID.GetProject() == "" || workflowExecutionID.GetDomain() == "" { | ||||||
return nil, fmt.Errorf("workflow execution identifier must have project, domain") | ||||||
} | ||||||
|
||||||
// Wrap executionPhase in ExecutionPhaseDeleteInput | ||||||
input := repositoryInterfaces.ExecutionPhaseDeleteInput{ | ||||||
Project: workflowExecutionID.GetProject(), | ||||||
Domain: workflowExecutionID.GetDomain(), | ||||||
ExecutionPhase: executionPhase, | ||||||
} | ||||||
|
||||||
err := m.db.ExecutionRepo().Delete(ctx, input) | ||||||
if err != nil { | ||||||
return nil, err | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding context to error return
Consider adding error wrapping with context when returning the database error. This would help with debugging by providing more context about what operation failed. Maybe something like: Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #50b8fe Should Bito avoid suggestions like this for future reviews? (Manage Rules)
|
||||||
} | ||||||
|
||||||
return &admin.ExecutionPhaseDeleteResponse{ | ||||||
Message: fmt.Sprintf("Execution phase %s for workflow %s/%s deleted successfully", | ||||||
executionPhase.String(), | ||||||
workflowExecutionID.GetProject(), | ||||||
workflowExecutionID.GetDomain()), | ||||||
}, nil | ||||||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,3 +152,17 @@ | |
m.Metrics.executionEndpointMetrics.terminate.Success() | ||
return response, nil | ||
} | ||
|
||
func (m *AdminService) DeleteExecutionPhase( | ||
ctx context.Context, request *admin.ExecutionPhaseDeleteRequest) (*admin.ExecutionPhaseDeleteResponse, error) { | ||
var response *admin.ExecutionPhaseDeleteResponse | ||
var err error | ||
m.Metrics.executionEndpointMetrics.terminate.Time(func() { | ||
response, err = m.ExecutionManager.DeleteExecutionPhase(ctx, request) | ||
Comment on lines
+160
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using specific metric for DeleteExecutionPhase
Consider using a more specific metric name for Code suggestionCheck the AI-generated fix before applying
Code Review Run #50b8fe Should Bito avoid suggestions like this for future reviews? (Manage Rules)
Comment on lines
+155
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you know where to see the metrics? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The data is stored in Prometheus, but 'flytectl demo start' does not launch Prometheus. |
||
}) | ||
if err != nil { | ||
return nil, util.TransformAndRecordError(err, &m.Metrics.executionEndpointMetrics.terminate) | ||
} | ||
m.Metrics.executionEndpointMetrics.terminate.Success() | ||
return response, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Consider adding more specific validation for the execution phase. The current check only validates against
UNDEFINED
but there may be other invalid phases. Consider validating against a list of allowed phases.Code suggestion
Code Review Run #26e38f
Should Bito avoid suggestions like this for future reviews? (Manage Rules)