class TolerationConstraint implements ConstraintEvaluator {

    @Override
    public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) {
        Optional<AgentInstance> instanceOpt = SchedulerUtils.findInstance(agentManagementService, configuration.getInstanceAttributeName(), targetVM);
        if (!instanceOpt.isPresent()) {
            return MACHINE_DOES_NOT_EXIST;
        }

        AgentInstance agentInstance = instanceOpt.get();

        Optional<AgentInstanceGroup> instanceGroupOpt = agentManagementService.findInstanceGroup(agentInstance.getInstanceGroupId());
        if (!instanceGroupOpt.isPresent()) {
            return MACHINE_GROUP_DOES_NOT_EXIST;
        }

        AgentInstanceGroup instanceGroup = instanceGroupOpt.get();

        Set<String> taints = getTaints(instanceGroup, agentInstance);
        return taints.contains(toleration) ? VALID : TOLERATION_DOES_NOT_MATCH;
    }

    public  TolerationConstraint(SchedulerConfiguration configuration, AgentManagementService agentManagementService, String machineId);

}