-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor step execution logic #46
Conversation
- refactored all the prep work into the handleNewServiceRequestEvent method - remove iterative loop to execute all steps continuation of step will be handled in another event handler
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.
Nice LGTM so far based on your explanation. Rn the logic for the steps aren't defined yet right?
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 |
@Ziyang-98 not completely. For example, the API Step currently only makes a simple GET request to a dummy endpoint
We will expose an endpoint for the frontend to query step statuses as well as service request statuses |
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 thisApproval
step should not trigger theStepCompletedEvent
. 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 theStepCompletedEvent
at the end of execution without any worries.