github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/requester/jobtransform/execution_plan.go (about)

     1  package jobtransform
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/filecoin-project/bacalhau/pkg/job"
     7  	"github.com/filecoin-project/bacalhau/pkg/model"
     8  	"github.com/filecoin-project/bacalhau/pkg/storage"
     9  	"github.com/pkg/errors"
    10  )
    11  
    12  func NewExecutionPlanner(provider storage.StorageProvider) Transformer {
    13  	return func(ctx context.Context, j *model.Job) (modified bool, err error) {
    14  		executionPlan, err := job.GenerateExecutionPlan(ctx, j.Spec, provider)
    15  		if err != nil {
    16  			return false, errors.Wrap(err, "error generating execution plan")
    17  		}
    18  		j.Spec.ExecutionPlan = executionPlan
    19  		return true, nil
    20  	}
    21  }