com.netflix.fenzo.ConstraintEvaluator Java Examples

The following examples show how to use com.netflix.fenzo.ConstraintEvaluator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MesosTaskManagerParameters.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static List<ConstraintEvaluator> parseConstraints(String mesosConstraints) {

		if (mesosConstraints == null || mesosConstraints.isEmpty()) {
			return Collections.emptyList();
		} else {
			List<ConstraintEvaluator> constraints = new ArrayList<>();

			for (String constraint : mesosConstraints.split(",")) {
				if (constraint.isEmpty()) {
					continue;
				}
				final String[] constraintList = constraint.split(":");
				if (constraintList.length != 2) {
					continue;
				}
				addHostAttrValueConstraint(constraints, constraintList[0], constraintList[1]);
			}

			return constraints;
		}
	}
 
Example #2
Source File: KubeConstraintTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void taintNotToleratedInConfiguration() {
    AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID);
    when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance));

    V1Taint taint = createTaint("not_tolerated_taint_key", "NoSchedule", "not_tolerated_taint_value");
    V1Node node = createNode(INSTANCE_ID, true, Collections.singletonList(taint));
    when(indexer.getByKey(INSTANCE_ID)).thenReturn(node);

    ConstraintEvaluator.Result result = kubeConstraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()),
            taskTrackerState);
    assertThat(result.isSuccessful()).isFalse();
    assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.TAINT_NOT_TOLERATED_IN_CONFIGURATION_REASON);
}
 
Example #3
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 6 votes vote down vote up
private static List<ConstraintEvaluator> parseConstraints(String mesosConstraints) {

		if (mesosConstraints == null || mesosConstraints.isEmpty()) {
			return Collections.emptyList();
		} else {
			List<ConstraintEvaluator> constraints = new ArrayList<>();

			for (String constraint : mesosConstraints.split(",")) {
				if (constraint.isEmpty()) {
					continue;
				}
				final String[] constraintList = constraint.split(":");
				if (constraintList.length != 2) {
					continue;
				}
				addHostAttrValueConstraint(constraints, constraintList[0], constraintList[1]);
			}

			return constraints;
		}
	}
 
Example #4
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 6 votes vote down vote up
private static List<ConstraintEvaluator> parseConstraints(String mesosConstraints) {

		if (mesosConstraints == null || mesosConstraints.isEmpty()) {
			return Collections.emptyList();
		} else {
			List<ConstraintEvaluator> constraints = new ArrayList<>();

			for (String constraint : mesosConstraints.split(",")) {
				if (constraint.isEmpty()) {
					continue;
				}
				final String[] constraintList = constraint.split(":");
				if (constraintList.length != 2) {
					continue;
				}
				addHostAttrValueConstraint(constraints, constraintList[0], constraintList[1]);
			}

			return constraints;
		}
	}
 
Example #5
Source File: V3QueueableTask.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
private List<ConstraintEvaluator> toFenzoHardConstraints(Job<?> job,
                                                         SystemHardConstraint systemHardConstraint,
                                                         ConstraintEvaluatorTransformer<Pair<String, String>> constraintEvaluatorTransformer,
                                                         Supplier<Set<String>> runningTasksGetter) {
    List<ConstraintEvaluator> result = new ArrayList<>();
    result.add(systemHardConstraint);
    job.getJobDescriptor().getContainer().getHardConstraints().forEach((key, value) ->
            constraintEvaluatorTransformer.hardConstraint(Pair.of(key, value), runningTasksGetter).ifPresent(result::add)
    );

    return result;
}
 
Example #6
Source File: KubeConstraintTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void nodeNotReady() {
    AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID);
    when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance));

    V1Node node = createNode(INSTANCE_ID, false, Collections.emptyList());
    when(indexer.getByKey(INSTANCE_ID)).thenReturn(node);

    ConstraintEvaluator.Result result = kubeConstraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()),
            taskTrackerState);
    assertThat(result.isSuccessful()).isFalse();
    assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.NODE_NOT_READY_REASON);
}
 
Example #7
Source File: MesosTaskManagerParameters.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public MesosTaskManagerParameters(
		double cpus,
		int gpus,
		ContainerType containerType,
		Option<String> containerImageName,
		ContaineredTaskManagerParameters containeredParameters,
		List<Protos.Volume> containerVolumes,
		List<Protos.Parameter> dockerParameters,
		boolean dockerForcePullImage,
		List<ConstraintEvaluator> constraints,
		String command,
		Option<String> bootstrapCommand,
		Option<String> taskManagerHostname,
		List<String> uris) {

	this.cpus = cpus;
	this.gpus = gpus;
	this.containerType = Preconditions.checkNotNull(containerType);
	this.containerImageName = Preconditions.checkNotNull(containerImageName);
	this.containeredParameters = Preconditions.checkNotNull(containeredParameters);
	this.containerVolumes = Preconditions.checkNotNull(containerVolumes);
	this.dockerParameters = Preconditions.checkNotNull(dockerParameters);
	this.dockerForcePullImage = dockerForcePullImage;
	this.constraints = Preconditions.checkNotNull(constraints);
	this.command = Preconditions.checkNotNull(command);
	this.bootstrapCommand = Preconditions.checkNotNull(bootstrapCommand);
	this.taskManagerHostname = Preconditions.checkNotNull(taskManagerHostname);
	this.uris = Preconditions.checkNotNull(uris);
}
 
Example #8
Source File: AppConstraintEvaluatorTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
private TaskRequest getTask(final String jobName) {
    TaskRequest result = Mockito.mock(TaskRequest.class);
    Mockito.when(result.getCPUs()).thenReturn(1.0d);
    Mockito.when(result.getMemory()).thenReturn(128.0d);
    Mockito.when(result.getHardConstraints()).thenAnswer(new Answer<List<? extends ConstraintEvaluator>>() {
        @Override
        public List<? extends ConstraintEvaluator> answer(final InvocationOnMock invocationOnMock) throws Throwable {
            return ImmutableList.of(AppConstraintEvaluator.getInstance());
        }
    });
    Mockito.when(result.getId()).thenReturn(new TaskContext(jobName, Collections.singletonList(0), ExecutionType.READY).getId());
    return result;
}
 
Example #9
Source File: KubeConstraintTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void successfullyScheduled() {
    AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID);
    when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance));

    V1Taint taint = createTaint("tolerated_taint_key", "NoSchedule", "tolerated_taint_value");
    V1Node node = createNode(INSTANCE_ID, true, Collections.singletonList(taint));
    when(indexer.getByKey(INSTANCE_ID)).thenReturn(node);

    ConstraintEvaluator.Result result = kubeConstraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()),
            taskTrackerState);
    assertThat(result.isSuccessful()).isTrue();
}
 
Example #10
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 5 votes vote down vote up
public MesosTaskManagerParameters(
		int gpus,
		int disk,
		int network,
		ContainerType containerType,
		Option<String> containerImageName,
		ContaineredTaskManagerParameters containeredParameters,
		List<Protos.Volume> containerVolumes,
		List<Protos.Parameter> dockerParameters,
		boolean dockerForcePullImage,
		List<ConstraintEvaluator> constraints,
		String command,
		Option<String> bootstrapCommand,
		Option<String> taskManagerHostname,
		List<String> uris) {

	this.gpus = gpus;
	this.disk = disk;
	this.network = network;
	this.containerType = Preconditions.checkNotNull(containerType);
	this.containerImageName = Preconditions.checkNotNull(containerImageName);
	this.containeredParameters = Preconditions.checkNotNull(containeredParameters);
	this.containerVolumes = Preconditions.checkNotNull(containerVolumes);
	this.dockerParameters = Preconditions.checkNotNull(dockerParameters);
	this.dockerForcePullImage = dockerForcePullImage;
	this.constraints = Preconditions.checkNotNull(constraints);
	this.command = Preconditions.checkNotNull(command);
	this.bootstrapCommand = Preconditions.checkNotNull(bootstrapCommand);
	this.taskManagerHostname = Preconditions.checkNotNull(taskManagerHostname);
	this.uris = Preconditions.checkNotNull(uris);
}
 
Example #11
Source File: MesosTaskManagerParametersTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void givenOneConstraintInConfigShouldBeParsed() throws Exception {

	MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo"));
	assertThat(mesosTaskManagerParameters.constraints().size(), is(1));
	ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster", new Func1<String, String>() {
		@Override
		public String call(String s) {
			return "foo";
		}
	});
	assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
}
 
Example #12
Source File: KubeConstraintTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void nodeNotFound() {
    AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID);
    when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance));

    when(indexer.getByKey(INSTANCE_ID)).thenReturn(null);

    ConstraintEvaluator.Result result = kubeConstraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()),
            taskTrackerState);
    assertThat(result.isSuccessful()).isFalse();
    assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.NODE_NOT_FOUND_REASON);
}
 
Example #13
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void addHostAttrValueConstraint(List<ConstraintEvaluator> constraints, String constraintKey, final String constraintValue) {
	constraints.add(new HostAttrValueConstraint(constraintKey, new Func1<String, String>() {
		@Override
		public String call(String s) {
			return constraintValue;
		}
	}));
}
 
Example #14
Source File: AgentContainerLimitSystemConstraintTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void testAtLeastOneContainerCanBeScheduled() {
    when(schedulerConfiguration.getMaxLaunchingTasksPerMachine()).thenReturn(0);
    ConstraintEvaluator.Result result = constraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()),
            taskTrackerState);
    assertThat(result.isSuccessful()).isTrue();
}
 
Example #15
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 5 votes vote down vote up
public MesosTaskManagerParameters(
		double cpus,
		int gpus,
		int disk,
		ContainerType containerType,
		Option<String> containerImageName,
		ContaineredTaskManagerParameters containeredParameters,
		List<Protos.Volume> containerVolumes,
		List<Protos.Parameter> dockerParameters,
		boolean dockerForcePullImage,
		List<ConstraintEvaluator> constraints,
		String command,
		Option<String> bootstrapCommand,
		Option<String> taskManagerHostname,
		List<String> uris) {

	this.cpus = cpus;
	this.gpus = gpus;
	this.disk = disk;
	this.containerType = Preconditions.checkNotNull(containerType);
	this.containerImageName = Preconditions.checkNotNull(containerImageName);
	this.containeredParameters = Preconditions.checkNotNull(containeredParameters);
	this.containerVolumes = Preconditions.checkNotNull(containerVolumes);
	this.dockerParameters = Preconditions.checkNotNull(dockerParameters);
	this.dockerForcePullImage = dockerForcePullImage;
	this.constraints = Preconditions.checkNotNull(constraints);
	this.command = Preconditions.checkNotNull(command);
	this.bootstrapCommand = Preconditions.checkNotNull(bootstrapCommand);
	this.taskManagerHostname = Preconditions.checkNotNull(taskManagerHostname);
	this.uris = Preconditions.checkNotNull(uris);
}
 
Example #16
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void addHostAttrValueConstraint(List<ConstraintEvaluator> constraints, String constraintKey, final String constraintValue) {
	constraints.add(new HostAttrValueConstraint(constraintKey, new Func1<String, String>() {
		@Override
		public String call(String s) {
			return constraintValue;
		}
	}));
}
 
Example #17
Source File: MesosTaskManagerParametersTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void givenOneConstraintInConfigShouldBeParsed() throws Exception {

	MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo"));
	assertThat(mesosTaskManagerParameters.constraints().size(), is(1));
	ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster", new Func1<String, String>() {
		@Override
		public String call(String s) {
			return "foo";
		}
	});
	assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
}
 
Example #18
Source File: AgentContainerLimitSystemConstraintTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void testContainerLimit() {
    when(schedulerConfiguration.getMaxLaunchingTasksPerMachine()).thenReturn(2);
    ConstraintEvaluator.Result result = constraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), createMockAssignmentResultList(2)),
            taskTrackerState);
    assertThat(result.isSuccessful()).isFalse();
}
 
Example #19
Source File: MesosTaskManagerParameters.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static void addHostAttrValueConstraint(List<ConstraintEvaluator> constraints, String constraintKey, final String constraintValue) {
	constraints.add(new HostAttrValueConstraint(constraintKey, new Func1<String, String>() {
		@Override
		public String call(String s) {
			return constraintValue;
		}
	}));
}
 
Example #20
Source File: MesosTaskManagerParametersTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void givenOneConstraintInConfigShouldBeParsed() throws Exception {

	MesosTaskManagerParameters mesosTaskManagerParameters = MesosTaskManagerParameters.create(withHardHostAttrConstraintConfiguration("cluster:foo"));
	assertThat(mesosTaskManagerParameters.constraints().size(), is(1));
	ConstraintEvaluator firstConstraintEvaluator = new HostAttrValueConstraint("cluster", new Func1<String, String>() {
		@Override
		public String call(String s) {
			return "foo";
		}
	});
	assertThat(mesosTaskManagerParameters.constraints().get(0).getName(), is(firstConstraintEvaluator.getName()));
}
 
Example #21
Source File: KubeConstraintTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void instanceNotFound() {
    when(agentManagementService.findAgentInstance(any())).thenReturn(Optional.empty());
    ConstraintEvaluator.Result result = kubeConstraint.evaluate(
            createTaskRequest(TASK_ID),
            createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()),
            taskTrackerState);
    assertThat(result.isSuccessful()).isFalse();
    assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.INSTANCE_NOT_FOUND_REASON);
}
 
Example #22
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Get the placement constraints.
 */
public List<ConstraintEvaluator> constraints() {
	return constraints;
}
 
Example #23
Source File: CompositeSystemConstraint.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
public CompositeSystemConstraint(List<SystemConstraint> evaluators) {
    Preconditions.checkArgument(!evaluators.isEmpty());

    this.evaluators = evaluators;
    this.name = "CompositeOf(" + String.join(",", evaluators.stream().map(ConstraintEvaluator::getName).collect(Collectors.toList())) + ')';
}
 
Example #24
Source File: MesosTaskManagerParameters.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Create the Mesos TaskManager parameters.
 *
 * @param flinkConfig the TM configuration.
 */
public static MesosTaskManagerParameters create(Configuration flinkConfig) {

	List<ConstraintEvaluator> constraints = parseConstraints(flinkConfig.getString(MESOS_CONSTRAINTS_HARD_HOSTATTR));

	// parse the common parameters
	ContaineredTaskManagerParameters containeredParameters = createContaineredTaskManagerParameters(flinkConfig);

	int gpus = flinkConfig.getInteger(MESOS_RM_TASKS_GPUS);

	if (gpus < 0) {
		throw new IllegalConfigurationException(MESOS_RM_TASKS_GPUS.key() +
			" cannot be negative");
	}

	int disk = flinkConfig.getInteger(MESOS_RM_TASKS_DISK_MB);

	int network = flinkConfig.getInteger(MESOS_RM_TASKS_NETWORK_MB_PER_SEC);

	// parse the containerization parameters
	String imageName = flinkConfig.getString(MESOS_RM_CONTAINER_IMAGE_NAME);

	ContainerType containerType;
	String containerTypeString = flinkConfig.getString(MESOS_RM_CONTAINER_TYPE);
	switch (containerTypeString) {
		case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_MESOS:
			containerType = ContainerType.MESOS;
			break;
		case MESOS_RESOURCEMANAGER_TASKS_CONTAINER_TYPE_DOCKER:
			containerType = ContainerType.DOCKER;
			if (imageName == null || imageName.length() == 0) {
				throw new IllegalConfigurationException(MESOS_RM_CONTAINER_IMAGE_NAME.key() +
					" must be specified for docker container type");
			}
			break;
		default:
			throw new IllegalConfigurationException("invalid container type: " + containerTypeString);
	}

	Option<String> containerVolOpt = Option.<String>apply(flinkConfig.getString(MESOS_RM_CONTAINER_VOLUMES));

	Option<String> dockerParamsOpt = Option.<String>apply(flinkConfig.getString(MESOS_RM_CONTAINER_DOCKER_PARAMETERS));

	Option<String> uriParamsOpt = Option.<String>apply(flinkConfig.getString(MESOS_TM_URIS));

	boolean dockerForcePullImage = flinkConfig.getBoolean(MESOS_RM_CONTAINER_DOCKER_FORCE_PULL_IMAGE);

	List<Protos.Volume> containerVolumes = buildVolumes(containerVolOpt);

	List<Protos.Parameter> dockerParameters = buildDockerParameters(dockerParamsOpt);

	List<String> uris = buildUris(uriParamsOpt);

	//obtain Task Manager Host Name from the configuration
	Option<String> taskManagerHostname = Option.apply(flinkConfig.getString(MESOS_TM_HOSTNAME));

	//obtain command-line from the configuration
	String tmCommand = flinkConfig.getString(MESOS_TM_CMD);
	Option<String> tmBootstrapCommand = Option.apply(flinkConfig.getString(MESOS_TM_BOOTSTRAP_CMD));

	return new MesosTaskManagerParameters(
		gpus,
		disk,
		network,
		containerType,
		Option.apply(imageName),
		containeredParameters,
		containerVolumes,
		dockerParameters,
		dockerForcePullImage,
		constraints,
		tmCommand,
		tmBootstrapCommand,
		taskManagerHostname,
		uris);
}
 
Example #25
Source File: LaunchableMesosWorker.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends ConstraintEvaluator> getHardConstraints() {
	return params.constraints();
}
 
Example #26
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Create mock RM dependencies.
 */
Context() throws Exception {
	rpcService = new TestingRpcService();
	fatalErrorHandler = new TestingFatalErrorHandler();
	rmServices = new MockMesosResourceManagerRuntimeServices();
	mesosServices = new MockMesosServices();

	// TaskExecutor templating
	ContainerSpecification containerSpecification = new ContainerSpecification();

	MemorySize totalProcessMemory = MemorySize.parse("2g");
	TaskExecutorProcessSpec spec = TaskExecutorProcessUtils
		.newProcessSpecBuilder(flinkConfig)
		.withCpuCores(1.0)
		.withTotalProcessMemory(totalProcessMemory)
		.build();
	ContaineredTaskManagerParameters containeredParams =
		new ContaineredTaskManagerParameters(spec, new HashMap<String, String>());
	MesosTaskManagerParameters tmParams = new MesosTaskManagerParameters(
		1, 0, 0, MesosTaskManagerParameters.ContainerType.MESOS, Option.<String>empty(), containeredParams,
		Collections.<Protos.Volume>emptyList(), Collections.<Protos.Parameter>emptyList(), false,
		Collections.<ConstraintEvaluator>emptyList(), "", Option.<String>empty(),
		Option.<String>empty(), Collections.<String>emptyList());

	// resource manager
	rmResourceID = ResourceID.generate();
	resourceManager =
		new TestingMesosResourceManager(
			rpcService,
			RM_ADDRESS,
			rmResourceID,
			rmServices.highAvailabilityServices,
			rmServices.heartbeatServices,
			rmServices.slotManager,
			rmServices.jobLeaderIdService,
			fatalErrorHandler,
			// Mesos specifics
			flinkConfig,
			mesosServices,
			rmServices.mesosConfig,
			tmParams,
			containerSpecification,
			UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup());
	workerResourceSpec = WorkerResourceSpec.fromTaskExecutorProcessSpec(spec);

	// TaskExecutors
	task1Executor = mockTaskExecutor(task1);
	task2Executor = mockTaskExecutor(task2);
	task3Executor = mockTaskExecutor(task3);

	// JobMaster
	jobMaster1 = mockJobMaster(rmServices, new JobID(1, 0));
}
 
Example #27
Source File: ClusterAgentAutoScalerTest.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends ConstraintEvaluator> getHardConstraints() {
    return Collections.emptyList();
}
 
Example #28
Source File: V3QueueableTask.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends ConstraintEvaluator> getHardConstraints() {
    return hardConstraints;
}
 
Example #29
Source File: JobTaskRequest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends ConstraintEvaluator> getHardConstraints() {
    return Collections.singletonList(AppConstraintEvaluator.getInstance());
}
 
Example #30
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Create mock RM dependencies.
 */
Context() throws Exception {
	rpcService = new TestingRpcService();
	fatalErrorHandler = new TestingFatalErrorHandler();
	rmServices = new MockMesosResourceManagerRuntimeServices();
	mesosServices = new MockMesosServices();

	// TaskExecutor templating
	ContainerSpecification containerSpecification = new ContainerSpecification();
	ContaineredTaskManagerParameters containeredParams =
		new ContaineredTaskManagerParameters(1024, 768, 256, 4, new HashMap<String, String>());
	MesosTaskManagerParameters tmParams = new MesosTaskManagerParameters(
		1.0, 1, 0, MesosTaskManagerParameters.ContainerType.MESOS, Option.<String>empty(), containeredParams,
		Collections.<Protos.Volume>emptyList(), Collections.<Protos.Parameter>emptyList(), false,
		Collections.<ConstraintEvaluator>emptyList(), "", Option.<String>empty(),
		Option.<String>empty(), Collections.<String>emptyList());

	// resource manager
	rmResourceID = ResourceID.generate();
	resourceManager =
		new TestingMesosResourceManager(
			rpcService,
			RM_ADDRESS,
			rmResourceID,
			rmServices.highAvailabilityServices,
			rmServices.heartbeatServices,
			rmServices.slotManager,
			rmServices.metricRegistry,
			rmServices.jobLeaderIdService,
			fatalErrorHandler,
			// Mesos specifics
			flinkConfig,
			mesosServices,
			rmServices.mesosConfig,
			tmParams,
			containerSpecification,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());

	// TaskExecutors
	task1Executor = mockTaskExecutor(task1);
	task2Executor = mockTaskExecutor(task2);
	task3Executor = mockTaskExecutor(task3);

	// JobMaster
	jobMaster1 = mockJobMaster(rmServices, new JobID(1, 0));
}