recipe

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package recipe provides two objects and manage their workflow:

  • Recipe : set of steps selected by the user (by tags/step type or step name on CLI)
  • Cookbook: set of recipes selected by the user (by name of recipe on the CLI)

The folder of a recipe must contains at least two folders:

  • steps containing the step files of the recipe
  • datasources containing the datasource files to be used by the recipe

but it can also contain whatever files/folders needed for the steps (initial dataset, templates, script, etc...). All the relative path defined in a step will be relative to the recipe folder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cookbook

type Cookbook struct {
	Recipes map[string]recipe
	// contains filtered or unexported fields
}

Cookbook is a map of recipe indexed by recipe's name.

func New

func New(sf step.Creater, connectionTimeout time.Duration, connectionRetry int, force bool, sequential bool, validate bool, dryRun bool) *Cookbook

New returns a new.

func (*Cookbook) Do

func (ck *Cookbook) Do(ctx context.Context, log *logrus.Entry) bool

Do will start one parallel recipe executor by recipe Each recipe executor will run all the steps of the recipes by priorities. All the step of same priority level will be parellelized or sequentialized (defined by the Cookbook.sequential flags), and the executor will wait for all them before starting the next batch of step. If an error occurs in one of the steps or user CTRL+C , all the same priority level steps will receive an cancelation that they could use to rollback by example and all the step with a priority level not already launched will not be runned.

func (*Cookbook) Load

func (ck *Cookbook) Load(ctx context.Context, log *logrus.Entry, configPath string, recipes []string, limitedTags []string, stepNames []string, stepTypes []string) error

Load Lookup the provided folder for recipes folder and will return a Cookbook of the selected recipes/steps. For each recipe, it will load all datasources and the selected steps.

func (*Cookbook) PostLoad

func (ck *Cookbook) PostLoad(log *logrus.Entry, superseed map[string]string) error

PostLoad modify the loaded step values with the values provided in the map in argument.

func (*Cookbook) Statistics

func (ck *Cookbook) Statistics() (map[string][]int, int)

Statistics return number of step by priority by recipes and total number of steps.

type Cooker

type Cooker interface {
	Statistics() (map[string][]int, int)
	Load(context.Context, *logrus.Entry, string, []string, []string, []string, []string) error
	PostLoad(*logrus.Entry, map[string]string) error
	Do(context.Context, *logrus.Entry) bool
}

Cooker interface for cookbook testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL