当前位置: 首页>>代码示例>>Java>>正文


Java HardwareDescription类代码示例

本文整理汇总了Java中org.apache.flink.runtime.instance.HardwareDescription的典型用法代码示例。如果您正苦于以下问题:Java HardwareDescription类的具体用法?Java HardwareDescription怎么用?Java HardwareDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HardwareDescription类属于org.apache.flink.runtime.instance包,在下文中一共展示了HardwareDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWorkerStarted

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
/**
 * Test worker registration after launch.
 */
@Test
public void testWorkerStarted() throws Exception {
	new Context() {{
		// set the initial state with a (recovered) launched worker
		MesosWorkerStore.Worker worker1launched = MesosWorkerStore.Worker.newWorker(task1).launchWorker(slave1, slave1host);
		when(rmServices.workerStore.getFrameworkID()).thenReturn(Option.apply(framework1));
		when(rmServices.workerStore.recoverWorkers()).thenReturn(singletonList(worker1launched));
		startResourceManager();
		assertThat(resourceManager.workersInLaunch, hasEntry(extractResourceID(task1), worker1launched));

		final int dataPort = 1234;
		final HardwareDescription hardwareDescription = new HardwareDescription(1, 2L, 3L, 4L);
		// send registration message
		CompletableFuture<RegistrationResponse> successfulFuture =
			resourceManager.registerTaskExecutor(task1Executor.address, task1Executor.resourceID, slotReport, dataPort, hardwareDescription, timeout);
		RegistrationResponse response = successfulFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
		assertTrue(response instanceof TaskExecutorRegistrationSuccess);

		// verify the internal state
		assertThat(resourceManager.workersInLaunch, hasEntry(extractResourceID(task1), worker1launched));
	}};
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:MesosResourceManagerTest.java

示例2: TaskExecutorToResourceManagerConnection

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public TaskExecutorToResourceManagerConnection(
		Logger log,
		RpcService rpcService,
		String taskManagerAddress,
		ResourceID taskManagerResourceId,
		SlotReport slotReport,
		int dataPort,
		HardwareDescription hardwareDescription,
		String resourceManagerAddress,
		ResourceManagerId resourceManagerId,
		Executor executor,
		RegistrationConnectionListener<TaskExecutorRegistrationSuccess> registrationListener) {

	super(log, resourceManagerAddress, resourceManagerId, executor);

	this.rpcService = Preconditions.checkNotNull(rpcService);
	this.taskManagerAddress = Preconditions.checkNotNull(taskManagerAddress);
	this.taskManagerResourceId = Preconditions.checkNotNull(taskManagerResourceId);
	this.slotReport = Preconditions.checkNotNull(slotReport);
	this.dataPort = dataPort;
	this.hardwareDescription = Preconditions.checkNotNull(hardwareDescription);
	this.registrationListener = Preconditions.checkNotNull(registrationListener);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:TaskExecutorToResourceManagerConnection.java

示例3: ResourceManagerRegistration

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
ResourceManagerRegistration(
		Logger log,
		RpcService rpcService,
		String targetAddress,
		ResourceManagerId resourceManagerId,
		String taskExecutorAddress,
		ResourceID resourceID,
		SlotReport slotReport,
		int dataPort,
		HardwareDescription hardwareDescription) {

	super(log, rpcService, "ResourceManager", ResourceManagerGateway.class, targetAddress, resourceManagerId);
	this.taskExecutorAddress = checkNotNull(taskExecutorAddress);
	this.resourceID = checkNotNull(resourceID);
	this.slotReport = checkNotNull(slotReport);
	this.dataPort = dataPort;
	this.hardwareDescription = checkNotNull(hardwareDescription);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:19,代码来源:TaskExecutorToResourceManagerConnection.java

示例4: TaskManagerInfo

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
@JsonCreator
public TaskManagerInfo(
		@JsonDeserialize(using = ResourceIDDeserializer.class) @JsonProperty(FIELD_NAME_RESOURCE_ID) ResourceID resourceId,
		@JsonProperty(FIELD_NAME_ADDRESS) String address,
		@JsonProperty(FIELD_NAME_DATA_PORT) int dataPort,
		@JsonProperty(FIELD_NAME_LAST_HEARTBEAT) long lastHeartbeat,
		@JsonProperty(FIELD_NAME_NUMBER_SLOTS) int numberSlots,
		@JsonProperty(FIELD_NAME_NUMBER_AVAILABLE_SLOTS) int numberAvailableSlots,
		@JsonProperty(FIELD_NAME_HARDWARE) HardwareDescription hardwareDescription) {
	this.resourceId = Preconditions.checkNotNull(resourceId);
	this.address = Preconditions.checkNotNull(address);
	this.dataPort = dataPort;
	this.lastHeartbeat = lastHeartbeat;
	this.numberSlots = numberSlots;
	this.numberAvailableSlots = numberAvailableSlots;
	this.hardwareDescription = Preconditions.checkNotNull(hardwareDescription);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:TaskManagerInfo.java

示例5: TaskManagerDetailsInfo

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
@JsonCreator
public TaskManagerDetailsInfo(
		@JsonDeserialize(using = ResourceIDDeserializer.class) @JsonProperty(FIELD_NAME_RESOURCE_ID) ResourceID resourceId,
		@JsonProperty(FIELD_NAME_ADDRESS) String address,
		@JsonProperty(FIELD_NAME_DATA_PORT) int dataPort,
		@JsonProperty(FIELD_NAME_LAST_HEARTBEAT) long lastHeartbeat,
		@JsonProperty(FIELD_NAME_NUMBER_SLOTS) int numberSlots,
		@JsonProperty(FIELD_NAME_NUMBER_AVAILABLE_SLOTS) int numberAvailableSlots,
		@JsonProperty(FIELD_NAME_HARDWARE) HardwareDescription hardwareDescription,
		@JsonProperty(FIELD_NAME_METRICS) TaskManagerMetricsInfo taskManagerMetrics) {
	super(
		resourceId,
		address,
		dataPort,
		lastHeartbeat,
		numberSlots,
		numberAvailableSlots,
		hardwareDescription);

	this.taskManagerMetrics = Preconditions.checkNotNull(taskManagerMetrics);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:TaskManagerDetailsInfo.java

示例6: getRandomInstance

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public static Instance getRandomInstance(int numSlots) {
	if (numSlots <= 0) {
		throw new IllegalArgumentException();
	}
	
	InetAddress address;
	try {
		address = InetAddress.getByName("127.0.0.1");
	} catch (UnknownHostException e) {
		throw new RuntimeException("Test could not create IP address for localhost loopback.");
	}
	
	int ipcPort = port.getAndIncrement();
	int dataPort = port.getAndIncrement();
	
	InstanceConnectionInfo ci = new InstanceConnectionInfo(address, ipcPort, dataPort);
	
	final long GB = 1024L*1024*1024;
	HardwareDescription resources = new HardwareDescription(4, 4*GB, 3*GB, 2*GB);
	
	return new Instance(ci, new InstanceID(), resources, numSlots);
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:23,代码来源:SchedulerTestUtils.java

示例7: WorkerRegistration

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public WorkerRegistration(
		TaskExecutorGateway taskExecutorGateway,
		WorkerType worker,
		int dataPort,
		HardwareDescription hardwareDescription) {
	super(taskExecutorGateway);
	this.worker = Preconditions.checkNotNull(worker);
	this.dataPort = dataPort;
	this.hardwareDescription = Preconditions.checkNotNull(hardwareDescription);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:WorkerRegistration.java

示例8: registerTaskExecutor

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
@Override
public CompletableFuture<RegistrationResponse> registerTaskExecutor(
		final String taskExecutorAddress,
		final ResourceID taskExecutorResourceId,
		final SlotReport slotReport,
		final int dataPort,
		final HardwareDescription hardwareDescription,
		final Time timeout) {

	CompletableFuture<TaskExecutorGateway> taskExecutorGatewayFuture = getRpcService().connect(taskExecutorAddress, TaskExecutorGateway.class);

	return taskExecutorGatewayFuture.handleAsync(
		(TaskExecutorGateway taskExecutorGateway, Throwable throwable) -> {
			if (throwable != null) {
				return new RegistrationResponse.Decline(throwable.getMessage());
			} else {
				return registerTaskExecutorInternal(
					taskExecutorGateway,
					taskExecutorAddress,
					taskExecutorResourceId,
					slotReport,
					dataPort,
					hardwareDescription);
			}
		},
		getMainThreadExecutor());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:28,代码来源:ResourceManager.java

示例9: registerTaskExecutor

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
@Override
public CompletableFuture<RegistrationResponse> registerTaskExecutor(String taskExecutorAddress, ResourceID resourceId, SlotReport slotReport, int dataPort, HardwareDescription hardwareDescription, Time timeout) {
	return CompletableFuture.completedFuture(
		new TaskExecutorRegistrationSuccess(
			new InstanceID(),
			resourceId,
			heartbeatInterval));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:TestingResourceManagerGateway.java

示例10: createRandomTaskManagerInfo

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
static TaskManagerInfo createRandomTaskManagerInfo() {
	return new TaskManagerInfo(
		ResourceID.generate(),
		UUID.randomUUID().toString(),
		random.nextInt(),
		random.nextLong(),
		random.nextInt(),
		random.nextInt(),
		new HardwareDescription(
			random.nextInt(),
			random.nextLong(),
			random.nextLong(),
			random.nextLong()));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:TaskManagerInfoTest.java

示例11: TerminalStateDeadlockTest

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public TerminalStateDeadlockTest() {
	try {
		// the reflection fields to access the private fields
		this.stateField = Execution.class.getDeclaredField("state");
		this.stateField.setAccessible(true);

		this.resourceField = Execution.class.getDeclaredField("assignedResource");
		this.resourceField.setAccessible(true);

		this.execGraphStateField = ExecutionGraph.class.getDeclaredField("state");
		this.execGraphStateField.setAccessible(true);

		this.execGraphSlotProviderField = ExecutionGraph.class.getDeclaredField("slotProvider");
		this.execGraphSlotProviderField.setAccessible(true);
		
		// the dummy resource
		ResourceID resourceId = ResourceID.generate();
		InetAddress address = InetAddress.getByName("127.0.0.1");
		TaskManagerLocation ci = new TaskManagerLocation(resourceId, address, 12345);
			
		HardwareDescription resources = new HardwareDescription(4, 4000000, 3000000, 2000000);
		Instance instance = new Instance(
			new ActorTaskManagerGateway(DummyActorGateway.INSTANCE), ci, new InstanceID(), resources, 4);

		this.resource = instance.allocateSimpleSlot(new JobID());
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
		
		// silence the compiler
		throw new RuntimeException();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:35,代码来源:TerminalStateDeadlockTest.java

示例12: getInstance

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public static Instance getInstance(final TaskManagerGateway gateway, final int numberOfSlots) throws Exception {
	ResourceID resourceID = ResourceID.generate();
	HardwareDescription hardwareDescription = new HardwareDescription(4, 2L*1024*1024*1024, 1024*1024*1024, 512*1024*1024);
	InetAddress address = InetAddress.getByName("127.0.0.1");
	TaskManagerLocation connection = new TaskManagerLocation(resourceID, address, 10001);

	return new Instance(gateway, connection, new InstanceID(), hardwareDescription, numberOfSlots);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:ExecutionGraphTestUtils.java

示例13: getRandomInstance

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public static Instance getRandomInstance(int numSlots) {
	if (numSlots <= 0) {
		throw new IllegalArgumentException();
	}
	
	final ResourceID resourceID = ResourceID.generate();
	final InetAddress address;
	try {
		address = InetAddress.getByName("127.0.0.1");
	}
	catch (UnknownHostException e) {
		throw new RuntimeException("Test could not create IP address for localhost loopback.");
	}
	
	int dataPort = port.getAndIncrement();
	
	TaskManagerLocation ci = new TaskManagerLocation(resourceID, address, dataPort);
	
	final long GB = 1024L*1024*1024;
	HardwareDescription resources = new HardwareDescription(4, 4*GB, 3*GB, 2*GB);
	
	return new Instance(
		new ActorTaskManagerGateway(DummyActorGateway.INSTANCE),
		ci,
		new InstanceID(),
		resources,
		numSlots);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:29,代码来源:SchedulerTestUtils.java

示例14: registerTaskManager

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
@Override
public InstanceID registerTaskManager(InstanceConnectionInfo instanceConnectionInfo, HardwareDescription hardwareDescription, int numberOfSlots) {
	if (this.instanceManager != null && this.scheduler != null) {
		return this.instanceManager.registerTaskManager(instanceConnectionInfo, hardwareDescription, numberOfSlots);
	} else {
		return null;
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:9,代码来源:JobManager.java

示例15: getInstance

import org.apache.flink.runtime.instance.HardwareDescription; //导入依赖的package包/类
public static Instance getInstance(final TaskOperationProtocol top) throws Exception {
	HardwareDescription hardwareDescription = new HardwareDescription(4, 2L*1024*1024*1024, 1024*1024*1024, 512*1024*1024);
	InetAddress address = InetAddress.getByName("127.0.0.1");
	InstanceConnectionInfo connection = new InstanceConnectionInfo(address, 10000, 10001);
	
	return new Instance(connection, new InstanceID(), hardwareDescription, 1) {
		@Override
		public TaskOperationProtocol getTaskManagerProxy() {
			return top;
		}
	};
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:13,代码来源:ExecutionGraphTestUtils.java


注:本文中的org.apache.flink.runtime.instance.HardwareDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。