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

Add a pipeline recording feature to resolve dependencies for Steps #55

Merged
merged 4 commits into from
Aug 14, 2022

Conversation

ccremer
Copy link
Owner

@ccremer ccremer commented Aug 9, 2022

Summary

Adds a Recorder and Dependency resolving feature that allows to record which steps have executed and the means to check for them.
The recorder can be activated simply using this:

recorder := NewDependencyRecorder[context.Context]()
p := NewPipeline[context.Context]().WithBeforeHooks(recorder.Record)

This enables to define a simple step dependency and ordering mechanism at compile time and runtime.

p.NewStep("step 2", func(_ context.Context) error {
	if err := recorder.RequireDependencyByStepName("step 1"); err != nil {
		return err
	}
	// this won't run if "step 1" didn't execute
	fmt.Println("running step 2")
	return nil
}),

Checklist

  • Categorize the PR by setting a good title and adding one of the labels:
    fix, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Update documentation.
  • Update tests.

@ccremer ccremer force-pushed the recorder branch 2 times, most recently from 30a2887 to 07ff710 Compare August 14, 2022 11:16
@ccremer ccremer marked this pull request as ready for review August 14, 2022 12:59
@ccremer ccremer added the enhancement New feature or request label Aug 14, 2022
@ccremer ccremer changed the title Recorder Add a pipeline recording feature to resolve dependencies for Steps Aug 14, 2022
@ccremer ccremer merged commit 51a4fef into master Aug 14, 2022
@ccremer ccremer deleted the recorder branch August 14, 2022 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant