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

Refactor step execution logic #46

Merged
merged 7 commits into from
Jan 31, 2024

Conversation

joshtyf
Copy link
Owner

@joshtyf joshtyf commented Jan 30, 2024

Description

In this PR, I split the execution of the service request.

Rationale

Previously, we were executing the steps within an iterative loop. However, we had no control over the execution flow once it started as it was hidden within the function. This poses a challenge to the future Approve step that we want to implement.

Change

This PR creates a new event called StepCompletedEvent. With this new event, we can trigger it whenever a step finishes completion. The handler for this event will prepare the subsequent step according to the results/errors of the completed step.

This way we can introduce a pause within the execution flow. For example, we can create an Approval step that sends a notification to the approver. But this Approval step should not trigger the StepCompletedEvent. The event is only triggered when the backend server receives an API request from the frontend that signals the approval.

For other steps like the APIStep created in #38, we can trigger the StepCompletedEvent at the end of execution without any worries.

@joshtyf joshtyf added backend Backend related refactor Code refactor or updates labels Jan 30, 2024
@joshtyf joshtyf added this to the M1: Basic setup milestone Jan 30, 2024
@joshtyf joshtyf self-assigned this Jan 30, 2024
Copy link
Collaborator

@Ziyang-98 Ziyang-98 left a comment

Choose a reason for hiding this comment

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

Nice LGTM so far based on your explanation. Rn the logic for the steps aren't defined yet right?

@Ziyang-98
Copy link
Collaborator

Ziyang-98 commented Jan 31, 2024

Also, can I check if how to see the current step is running and the progress status of the current step for the service in the FE? This is to show the status of the pipeline in the dashboard

@joshtyf
Copy link
Owner Author

joshtyf commented Jan 31, 2024

Rn the logic for the steps aren't defined yet right?

@Ziyang-98 not completely. For example, the API Step currently only makes a simple GET request to a dummy endpoint

can I check if how to see the current step is running and the progress status of the current step for the service in the FE?

We will expose an endpoint for the frontend to query step statuses as well as service request statuses

@joshtyf joshtyf merged commit bc0ef1d into main Jan 31, 2024
2 checks passed
@joshtyf joshtyf deleted the refactor/apply-granular-control-over-step-execution branch January 31, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related refactor Code refactor or updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants