Search in sources :

Example 1 with LikeConstraint

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

the class TestObjectFactory method getNodeTask.

/**
 * Returns a NodeTask with either a ServiceResourceProfile or an ExtendedResourceProfile,
 * depending upon whether execCores and execMemory are null or non-null, respectively
 *
 * @param profileName
 * @param hostName
 * @param cores
 * @param memory
 * @param execCores
 * @param execMemory
 * @return NodeTask
 */
public static NodeTask getNodeTask(String profileName, String hostName, Double cores, Double memory, Long execCores, Long execMemory) {
    NodeTask task = new NodeTask(getServiceResourceProfile(profileName, cores, memory, execCores, execMemory), new LikeConstraint(hostName, "host-[0-9]*.example.com"));
    task.setHostname(hostName);
    task.setTaskPrefix("nm");
    task.setSlaveId(SlaveID.newBuilder().setValue(profileName + "-" + hostName).build());
    task.setExecutorInfo(ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("exec")).setCommand(org.apache.mesos.Protos.CommandInfo.newBuilder().setValue("command")).build());
    return task;
}
Also used : NodeTask(org.apache.myriad.state.NodeTask) LikeConstraint(org.apache.myriad.scheduler.constraints.LikeConstraint)

Example 2 with LikeConstraint

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

the class SchedulerStateResourceTest method getSchedulerState.

private SchedulerState getSchedulerState() throws Exception {
    SchedulerState state = new SchedulerState(new MyriadFileSystemRMStateStore());
    idOne = Protos.TaskID.newBuilder().setValue("nt-1").build();
    idTwo = Protos.TaskID.newBuilder().setValue("nt-2").build();
    idThree = Protos.TaskID.newBuilder().setValue("nt-3").build();
    TreeMap<String, Long> ports = new TreeMap<>();
    state.addTask(idOne, new NodeTask(new ServiceResourceProfile("profile1", 0.2, 1024.0, ports), new LikeConstraint("localhost", "host-[0-9]*.example.com")));
    state.addTask(idTwo, new NodeTask(new ServiceResourceProfile("profile2", 0.4, 2048.0, ports), new LikeConstraint("localhost", "host-[0-9]*.example.com")));
    state.addTask(idThree, new NodeTask(new ServiceResourceProfile("profile3", 0.6, 3072.0, ports), new LikeConstraint("localhost", "host-[0-9]*.example.com")));
    state.setFrameworkId(FrameworkID.newBuilder().setValue("mock-framework").build());
    state.makeTaskActive(idOne);
    state.makeTaskPending(idTwo);
    state.makeTaskStaging(idThree);
    return state;
}
Also used : SchedulerState(org.apache.myriad.state.SchedulerState) MyriadFileSystemRMStateStore(org.apache.hadoop.yarn.server.resourcemanager.recovery.MyriadFileSystemRMStateStore) ServiceResourceProfile(org.apache.myriad.scheduler.ServiceResourceProfile) TreeMap(java.util.TreeMap) NodeTask(org.apache.myriad.state.NodeTask) LikeConstraint(org.apache.myriad.scheduler.constraints.LikeConstraint)

Example 3 with LikeConstraint

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

the class NodeTaskTest method setUp.

@Before
public void setUp() throws Exception {
    TreeMap<String, Long> ports = new TreeMap<>();
    task = new NodeTask(new ServiceResourceProfile("profile", 0.1, 1024.0, ports), new LikeConstraint("hostname", "host-[0-9]*.example.com"));
    task.setHostname("localhost");
    task.setTaskPrefix("prefix");
    task.setProfile(new ServiceResourceProfile("ServiceResourceProfile", 0.1, 1024.0, ports));
}
Also used : ServiceResourceProfile(org.apache.myriad.scheduler.ServiceResourceProfile) TreeMap(java.util.TreeMap) LikeConstraint(org.apache.myriad.scheduler.constraints.LikeConstraint) Before(org.junit.Before)

Example 4 with LikeConstraint

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

the class TestObjectFactory method getNodeTask.

/**
 * Returns a NodeTask given a ServiceResourceProfile and hostname
 *
 * @param hostName
 * @param profile
 * @return
 */
public static NodeTask getNodeTask(String hostName, ServiceResourceProfile profile) {
    NodeTask task = new NodeTask(profile, new LikeConstraint(hostName, "host-[0-9]*.example.com"));
    task.setHostname(hostName);
    task.setTaskPrefix("nm");
    task.setSlaveId(SlaveID.newBuilder().setValue(profile.getName() + "-" + hostName).build());
    task.setExecutorInfo(ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("exec")).setCommand(org.apache.mesos.Protos.CommandInfo.newBuilder().setValue("command")).build());
    return task;
}
Also used : NodeTask(org.apache.myriad.state.NodeTask) LikeConstraint(org.apache.myriad.scheduler.constraints.LikeConstraint)

Example 5 with LikeConstraint

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

the class ByteBufferSupportTest method setUp.

@Before
public void setUp() throws Exception {
    task = new NodeTask(new ServiceResourceProfile("profile", 0.1, 1024.0, new TreeMap<String, Long>()), new LikeConstraint("hostname", "host-[0-9]*.example.com"));
    task.setHostname("localhost");
    task.setTaskPrefix("prefix");
    task.setExecutorInfo(getExecutorInfo());
}
Also used : ServiceResourceProfile(org.apache.myriad.scheduler.ServiceResourceProfile) NodeTask(org.apache.myriad.state.NodeTask) LikeConstraint(org.apache.myriad.scheduler.constraints.LikeConstraint) Before(org.junit.Before)

Aggregations

LikeConstraint (org.apache.myriad.scheduler.constraints.LikeConstraint)5 NodeTask (org.apache.myriad.state.NodeTask)4 ServiceResourceProfile (org.apache.myriad.scheduler.ServiceResourceProfile)3 TreeMap (java.util.TreeMap)2 Before (org.junit.Before)2 MyriadFileSystemRMStateStore (org.apache.hadoop.yarn.server.resourcemanager.recovery.MyriadFileSystemRMStateStore)1 SchedulerState (org.apache.myriad.state.SchedulerState)1