-
Notifications
You must be signed in to change notification settings - Fork 310
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
[WIP] [Feature] impl delete execution phase #3162
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: taieeuu <[email protected]>
Code Review Agent Run #3b0d37Actionable Suggestions - 4
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
workflow_execution_id = WorkflowExecutionIdentifier(project=project, domain=domain, name="") | ||
|
||
request_dict = {"id": workflow_execution_id.to_flyte_idl(), "phase": phase} |
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 validating the phase
parameter against allowed execution phases before making the delete request. This could help catch invalid phase values early.
Code suggestion
Check the AI-generated fix before applying
workflow_execution_id = WorkflowExecutionIdentifier(project=project, domain=domain, name="") | |
request_dict = {"id": workflow_execution_id.to_flyte_idl(), "phase": phase} | |
VALID_PHASES = ["QUEUED", "RUNNING", "SUCCEEDED", "FAILED", "ABORTED", "TIMED_OUT"] | |
if phase not in VALID_PHASES: | |
raise ValueError(f"Invalid phase '{phase}'. Must be one of {VALID_PHASES}") | |
workflow_execution_id = WorkflowExecutionIdentifier(project=project, domain=domain, name="") | |
request_dict = {"id": workflow_execution_id.to_flyte_idl(), "phase": phase} |
Code Review Run #3b0d37
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
def delete_execution_phase(self, delete_execution_phase_request): | ||
""" | ||
:param flyteidl.admin.execution_pb2.DeleteExecutionPhaseRequest delete_execution_phase_request: | ||
:rtype: flyteidl.admin.execution_pb2.DeleteExecutionPhaseResponse | ||
""" | ||
return self._stub.DeleteExecutionPhase(delete_execution_phase_request, metadata=self._metadata) |
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 error handling for potential gRPC exceptions in the delete_execution_phase
method. The current implementation might fail silently if the gRPC call encounters network issues or server errors.
Code suggestion
Check the AI-generated fix before applying
def delete_execution_phase(self, delete_execution_phase_request): | |
""" | |
:param flyteidl.admin.execution_pb2.DeleteExecutionPhaseRequest delete_execution_phase_request: | |
:rtype: flyteidl.admin.execution_pb2.DeleteExecutionPhaseResponse | |
""" | |
return self._stub.DeleteExecutionPhase(delete_execution_phase_request, metadata=self._metadata) | |
def delete_execution_phase(self, delete_execution_phase_request): | |
""" | |
:param flyteidl.admin.execution_pb2.DeleteExecutionPhaseRequest delete_execution_phase_request: | |
:rtype: flyteidl.admin.execution_pb2.DeleteExecutionPhaseResponse | |
""" | |
try: | |
return self._stub.DeleteExecutionPhase(delete_execution_phase_request, metadata=self._metadata) | |
except grpc.RpcError as e: | |
logger.error(f"Failed to delete execution phase: {e}") | |
raise |
Code Review Run #3b0d37
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
def delete_execution_phase(self, execution: FlyteWorkflowExecution, phase: str): | ||
"""Delete a phase from executions. | ||
:param execution: workflow execution to delete phase from | ||
:param phase: phase to delete | ||
""" | ||
self.client.delete_execution_phase(execution.id.project, execution.id.domain, phase) |
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 validating the phase
parameter against allowed execution phases before making the delete call. This could help catch invalid phase values early.
Code suggestion
Check the AI-generated fix before applying
def delete_execution_phase(self, execution: FlyteWorkflowExecution, phase: str): | |
"""Delete a phase from executions. | |
:param execution: workflow execution to delete phase from | |
:param phase: phase to delete | |
""" | |
self.client.delete_execution_phase(execution.id.project, execution.id.domain, phase) | |
def delete_execution_phase(self, execution: FlyteWorkflowExecution, phase: str): | |
"""Delete a phase from executions. | |
:param execution: workflow execution to delete phase from | |
:param phase: phase to delete - must be a valid execution phase | |
:raises ValueError: if phase is not a valid execution phase | |
""" | |
valid_phases = {"RUNNING", "SUCCEEDED", "FAILED", "ABORTED"} | |
if phase not in valid_phases: | |
raise ValueError(f"Invalid phase {phase}. Must be one of {valid_phases}") | |
self.client.delete_execution_phase(execution.id.project, execution.id.domain, phase) |
Code Review Run #3b0d37
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
@click.option("-p", "--project", required=True, help="Project to delete execution phase from") | ||
@click.option("-d", "--domain", required=True, help="Domain to delete execution phase from") | ||
@click.option("-ph", "--phase", required=True, help="Phase to delete") | ||
def delete_execution_phase(host, insecure, project, domain, phase): |
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 validation for the phase
parameter to ensure it matches valid execution phase values. The phase
parameter appears to be used directly without validation which could lead to invalid phase deletion attempts.
Code suggestion
Check the AI-generated fix before applying
def delete_execution_phase(host, insecure, project, domain, phase): | |
VALID_PHASES = ["QUEUED", "RUNNING", "SUCCEEDED", "FAILED", "ABORTED", "TIMED_OUT"] | |
def delete_execution_phase(host, insecure, project, domain, phase): | |
if phase not in VALID_PHASES: | |
click.echo(f"\nInvalid phase value: {phase}. Valid phases are: {', '.join(VALID_PHASES)}") | |
sys.exit(1) |
Code Review Run #3b0d37
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
Tracking issue
Why are the changes needed?
What changes were proposed in this pull request?
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This PR implements a new feature for deleting execution phases in Flyte, adding functionality across client libraries, CLI interface, and remote execution components. The implementation enables phase deletion through both programmatic and command-line interfaces, with comprehensive phase validation checks. The changes include error handling for gRPC calls and consistent validation of execution phases across all interface layers.Unit tests added: False
Estimated effort to review (1-5, lower is better): 1