github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/executor/types.go (about)

     1  package executor
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/filecoin-project/bacalhau/pkg/model"
     7  )
     8  
     9  // Returns a executor for the given engine type
    10  type ExecutorProvider interface {
    11  	model.Provider[model.Engine, Executor]
    12  }
    13  
    14  // Executor represents an execution provider, which can execute jobs on some
    15  // kind of backend, such as a docker daemon.
    16  type Executor interface {
    17  	model.Providable
    18  
    19  	// used to filter and select jobs
    20  	//    tells us if the storage resource is "close" i.e. cheap to access
    21  	HasStorageLocally(context.Context, model.StorageSpec) (bool, error)
    22  	//    tells us how much storage the given volume would consume
    23  	//    which we then use to calculate if there is capacity
    24  	//    alongside cpu & memory usage
    25  	GetVolumeSize(context.Context, model.StorageSpec) (uint64, error)
    26  
    27  	// run the given job - it's expected that we have already prepared the job
    28  	// this will return a local filesystem path to the jobs results
    29  	RunShard(
    30  		ctx context.Context,
    31  		shard model.JobShard,
    32  		resultsDir string,
    33  	) (*model.RunCommandResult, error)
    34  }