Search in sources :

Example 6 with Constraint

use of org.apache.myriad.scheduler.constraints.Constraint in project incubator-myriad by apache.

the class MyriadOperations method flexDownTasks.

private int flexDownTasks(Collection<Protos.TaskID> taskIDs, ServiceResourceProfile profile, Constraint constraint, int numInstancesToScaleDown) {
    int numInstancesScaledDown = 0;
    for (Protos.TaskID taskID : taskIDs) {
        NodeTask nodeTask = schedulerState.getTask(taskID);
        if (nodeTask.getProfile().getName().equals(profile.getName()) && meetsConstraint(nodeTask, constraint)) {
            this.schedulerState.makeTaskKillable(taskID);
            numInstancesScaledDown++;
            if (numInstancesScaledDown == numInstancesToScaleDown) {
                break;
            }
        }
    }
    return numInstancesScaledDown;
}
Also used : Protos(org.apache.mesos.Protos) NodeTask(org.apache.myriad.state.NodeTask) LikeConstraint(org.apache.myriad.scheduler.constraints.LikeConstraint) Constraint(org.apache.myriad.scheduler.constraints.Constraint)

Aggregations

Constraint (org.apache.myriad.scheduler.constraints.Constraint)6 LikeConstraint (org.apache.myriad.scheduler.constraints.LikeConstraint)5 NodeTask (org.apache.myriad.state.NodeTask)3 Protos (org.apache.mesos.Protos)2 Type (org.apache.myriad.scheduler.constraints.Constraint.Type)2 ByteBuffer (java.nio.ByteBuffer)1 HashSet (java.util.HashSet)1 Offer (org.apache.mesos.Protos.Offer)1 TaskInfo (org.apache.mesos.Protos.TaskInfo)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1 ServiceResourceProfile (org.apache.myriad.scheduler.ServiceResourceProfile)1 ResourceOfferContainer (org.apache.myriad.scheduler.resource.ResourceOfferContainer)1