@ Override public Result evaluate ( TaskRequest taskRequest , VirtualMachineCurrentState targetVM , TaskTrackerState taskTrackerState ) { String targetHostAttrVal = getAttrValue ( targetVM . getCurrAvailableResources ( ) ) ; if ( targetHostAttrVal == null || targetHostAttrVal . isEmpty ( ) ) { return new Result ( false , hostAttributeName + " attribute unavailable on host " + targetVM . getCurrAvailableResources ( ) . hostname ( ) ) ; } String requiredAttrVal = hostAttributeValueGetter . call ( taskRequest . getId ( ) ) ; return targetHostAttrVal . equals ( requiredAttrVal ) ? new Result ( true , "" ) : new Result ( false , "Host attribute " + hostAttributeName + ": required=" + requiredAttrVal + ", got=" + targetHostAttrVal ) ; }
Tests a host to determine whether it has an attribute of the required value for this task request .