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

     1  package v1beta1
     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  	// should we accept jobs that specify networking
    21  	// the default is "reject"
    22  	AcceptNetworkedJobs bool `json:"accept_networked_jobs"`
    23  	// external hooks that decide if we should take on the job or not
    24  	// if either of these are given they will override the data locality settings
    25  	ProbeHTTP string `json:"probe_http,omitempty"`
    26  	ProbeExec string `json:"probe_exec,omitempty"`
    27  }
    28  
    29  // generate a default empty job selection policy
    30  func NewDefaultJobSelectionPolicy() JobSelectionPolicy {
    31  	return JobSelectionPolicy{}
    32  }