MCPcopy Index your code
hub / github.com/apache/devlake / MakePlanForBlueprint

Function MakePlanForBlueprint

backend/server/services/blueprint.go:359–382  ·  view source on GitHub ↗

MakePlanForBlueprint generates pipeline plan by version

(blueprint *models.Blueprint, syncPolicy *models.SyncPolicy)

Source from the content-addressed store, hash-verified

357
358// MakePlanForBlueprint generates pipeline plan by version
359func MakePlanForBlueprint(blueprint *models.Blueprint, syncPolicy *models.SyncPolicy) (models.PipelinePlan, errors.Error) {
360 var plan models.PipelinePlan
361 // load project metric plugins and convert it to a map
362 metrics := make(map[string]json.RawMessage)
363 projectMetrics := make([]models.ProjectMetricSetting, 0)
364 if blueprint.ProjectName != "" {
365 err := db.All(&projectMetrics, dal.Where("project_name = ? AND enable = ?", blueprint.ProjectName, true))
366 if err != nil {
367 return nil, err
368 }
369 for _, projectMetric := range projectMetrics {
370 metrics[projectMetric.PluginName] = projectMetric.PluginOption
371 }
372 }
373 skipCollectors := false
374 if syncPolicy != nil && syncPolicy.SkipCollectors {
375 skipCollectors = true
376 }
377 plan, err := GeneratePlanJsonV200(blueprint.ProjectName, blueprint.Connections, metrics, skipCollectors)
378 if err != nil {
379 return nil, err
380 }
381 return SequentializePipelinePlans(blueprint.BeforePlan, plan, blueprint.AfterPlan), nil
382}
383
384// ParallelizePipelinePlans merges multiple pipelines into one unified plan
385// by assuming they can be executed in parallel

Callers 2

Calls 3

GeneratePlanJsonV200Function · 0.85
AllMethod · 0.65

Tested by

no test coverage detected