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;
}
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;
}
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));
}
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;
}
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());
}
Aggregations