github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/model/v1alpha1/job_selection.go (about)

     1  package v1alpha1
     2  
     3  // Job selection policy configuration
     4  type JobSelectionDataLocality int64
     5  
     6  const (
     7  	Local    JobSelectionDataLocality = 0
     8  	Anywhere JobSelectionDataLocality = 1
     9  )
    10  
    11  // describe the rules for how a compute node selects an incoming job
    12  type JobSelectionPolicy struct {
    13  	// this describes if we should run a job based on
    14  	// where the data is located - i.e. if the data is "local"
    15  	// or if the data is "anywhere"
    16  	Locality JobSelectionDataLocality `json:"locality"`
    17  	// should we reject jobs that don't specify any data
    18  	// the default is "accept"
    19  	RejectStatelessJobs bool `json:"reject_stateless_jobs"`
    20  	// external hooks that decide if we should take on the job or not
    21  	// if either of these are given they will override the data locality settings
    22  	ProbeHTTP string `json:"probe_http,omitempty"`
    23  	ProbeExec string `json:"probe_exec,omitempty"`
    24  }
    25  
    26  // generate a default empty job selection policy
    27  func NewDefaultJobSelectionPolicy() JobSelectionPolicy {
    28  	return JobSelectionPolicy{}
    29  }