in astro/execution_set.go [96:129]
func (s executionSet) graph() (*dag.AcyclicGraph, error) {
graph := &dag.AcyclicGraph{}
// Add all executions to the graph to start off with
for _, e := range s {
graph.Add(e)
}
// For each execution, we need to find the dependencies and connect
// them in the graph.
for _, e := range s {
for _, dep := range e.ModuleConfig().Deps {
// Fill in any placeholders in the dependency with variable
// values from the current execution.
vars, err := replaceVarsInMapValues(dep.Variables, e.Variables())
if err != nil {
return nil, fmt.Errorf("unable to resolve vars for module: %s; %v", e.ModuleConfig().Name, err)
}
dep.Variables = vars
dependentExecutions, err := s.filterByDep(dep)
if err != nil {
return nil, fmt.Errorf("invalid dependency for %s: %v", e.ModuleConfig().Name, err)
}
for _, dependentExecution := range dependentExecutions {
graph.Connect(dag.BasicEdge(e, dependentExecution))
}
}
}
addRoot(graph)
return graph, nil
}