本文整理汇总了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));
}};
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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));
}
示例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()));
}
示例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();
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
};
}