func (n *Node) Evaluate(args *structs.NodeEvaluateRequest, reply *structs.NodeUpdateResponse) error {
	if done, err := n.srv.forward("Node.Evaluate", args, args, reply); done {
		return err
	}
	defer metrics.MeasureSince([]string{"nomad", "client", "evaluate"}, time.Now())

	// Verify the arguments
	if args.NodeID == "" {
		return fmt.Errorf("missing node ID for evaluation")
	}

	// Look for the node
	snap, err := n.srv.fsm.State().Snapshot()
	if err != nil {
		return err
	}
	ws := memdb.NewWatchSet()
	node, err := snap.NodeByID(ws, args.NodeID)
	if err != nil {
		return err
	}
	if node == nil {
		return fmt.Errorf("node not found")
	}

	// Create the evaluation
	evalIDs, evalIndex, err := n.createNodeEvals(args.NodeID, node.ModifyIndex)
	if err != nil {
		n.srv.logger.Printf("[ERR] nomad.client: eval creation failed: %v", err)
		return err
	}
	reply.EvalIDs = evalIDs
	reply.EvalCreateIndex = evalIndex

	// Set the reply index
	reply.Index = evalIndex

	n.srv.peerLock.RLock()
	defer n.srv.peerLock.RUnlock()
	if err := n.constructNodeServerInfoResponse(snap, reply); err != nil {
		n.srv.logger.Printf("[ERR] nomad.client: failed to populate NodeUpdateResponse: %v", err)
		return err
	}
	return nil
}
// Evaluate is used to force a re-evaluation of the node
Evaluate is used to force a re-evaluation of the node
// Evaluate is used to force a re - evaluation of the node
func (n *Node) Evaluate(args *structs.NodeEvaluateRequest, reply *structs.NodeUpdateResponse) error {
	if done, err := n.srv.forward("Node.Evaluate", args, args, reply); done {
		return err
	}
	defer metrics.MeasureSince([]string{"nomad", "client", "evaluate"}, time.Now())
	if args.NodeID == "" {
		return fmt.Errorf("missing node ID for evaluation")
	}
	snap, err := n.srv.fsm.State().Snapshot()
	if err != nil {
		return err
	}
	ws := memdb.NewWatchSet()
	node, err := snap.NodeByID(ws, args.NodeID)
	if err != nil {
		return err
	}
	if node == nil {
		return fmt.Errorf("node not found")
	}
	evalIDs, evalIndex, err := n.createNodeEvals(args.NodeID, node.ModifyIndex)
	if err != nil {
		n.srv.logger.Printf("[ERR] nomad.client: eval creation failed: %v", err)
		return err
	}
	reply.EvalIDs = evalIDs
	reply.EvalCreateIndex = evalIndex
	reply.Index = evalIndex
	n.srv.peerLock.RLock()
	defer n.srv.peerLock.RUnlock()
	if err := n.constructNodeServerInfoResponse(snap, reply); err != nil {
		n.srv.logger.Printf("[ERR] nomad.client: failed to populate NodeUpdateResponse: %v", err)
		return err
	}
	return nil
}
func ( n * Node ) Evaluate ( args * structs . NodeEvaluateRequest , reply * structs . NodeUpdateResponse ) error { if done , err := n . srv . forward ( " " , args , args , reply ) ; done { return err } defer metrics . MeasureSince ( [ ] string { " " , " " , " " } , time . Now ( ) ) if args . NodeID == " " { return fmt . Errorf ( " " ) } snap , err := n . srv . fsm . State ( ) . Snapshot ( ) if err != nil { return err } ws := memdb . NewWatchSet ( ) node , err := snap . NodeByID ( ws , args . NodeID ) if err != nil { return err } if node == nil { return fmt . Errorf ( " " ) } evalIDs , evalIndex , err := n . createNodeEvals ( args . NodeID , node . ModifyIndex ) if err != nil { n . srv . logger . Printf ( " " , err ) return err } reply . EvalIDs = evalIDs reply . EvalCreateIndex = evalIndex reply . Index = evalIndex n . srv . peerLock . RLock ( ) defer n . srv . peerLock . RUnlock ( ) if err := n . constructNodeServerInfoResponse ( snap , reply ) ; err != nil { n . srv . logger . Printf ( " " , err ) return err } return nil }
Evaluate is used to force a re-evaluation of the node
Evaluate is used to force a re - evaluation of the node
// Verify the arguments // Look for the node // Create the evaluation // Set the reply index