LabResourceDeviceMonitor

public class LabResourceDeviceMonitor
extends LabResourceServiceGrpc.LabResourceServiceImplBase implements IDeviceMonitor

java.lang.Object
   ↳ com.google.dualhomelab.monitoringagent.resourcemonitoring.LabResourceServiceGrpc.LabResourceServiceImplBase
     ↳ com.android.tradefed.monitoring.LabResourceDeviceMonitor


用于初始化/管理 LabResourceService 的 gRPC 服务器的实验资源监控器。如需添加资源指标收集器,请在全局配置中添加 resource_metric_collector 标记以加载收集器。

摘要

常量

int DEFAULT_PORT

int DEFAULT_THREAD_COUNT

String DEVICE_SERIAL_KEY

float FIXED_METRIC_VALUE

String HARDWARE_REVISION_RESOURCE_NAME

String HARNESS_VERSION_KEY

String HOST_GROUP_KEY

String HOST_NAME_KEY

String LAB_NAME_KEY

String POOL_ATTRIBUTE_NAME

String RUN_TARGET_ATTRIBUTE_NAME

String STATUS_RESOURCE_NAME

String TEST_HARNESS_KEY

公共构造函数

LabResourceDeviceMonitor()

公共方法

void getLabResource(LabResourceRequest request, StreamObserver<LabResource> responseObserver)

gRPC 请求处理程序。

void notifyDeviceStateChange(String serial, DeviceAllocationState oldState, DeviceAllocationState newState)

IDeviceMonitor 发出设备状态已更改的信号。

void run()

一种方法,将在设置完所有 Monitor 的 @Option 字段后调用。

void setDeviceLister(IDeviceMonitor.DeviceLister lister)

允许设置 DeviceLister

void stop()

需要在停止监控时调用的方法。

受保护的方法

LabResource getCachedLabResource()

常量

DEFAULT_PORT

public static final int DEFAULT_PORT

常量值: 8887 (0x000022b7)

DEFAULT_THREAD_COUNT

public static final int DEFAULT_THREAD_COUNT

常量值: 1 (0x00000001)

DEVICE_SERIAL_KEY

public static final String DEVICE_SERIAL_KEY

常量值: "device_serial"

FIXED_METRIC_VALUE

public static final float FIXED_METRIC_VALUE

常量值: 1.0

HARDWARE_REVISION_RESOURCE_NAME

public static final String HARDWARE_REVISION_RESOURCE_NAME

常量值: "hardware_revision"

HARNESS_VERSION_KEY

public static final String HARNESS_VERSION_KEY

常量值: "harness_version"

HOST_GROUP_KEY

public static final String HOST_GROUP_KEY

常量值: "host_group"

HOST_NAME_KEY

public static final String HOST_NAME_KEY

常量值: "hostname"

LAB_NAME_KEY

public static final String LAB_NAME_KEY

常量值: "lab_name"

POOL_ATTRIBUTE_NAME

public static final String POOL_ATTRIBUTE_NAME

常量值: “pool”

RUN_TARGET_ATTRIBUTE_NAME

public static final String RUN_TARGET_ATTRIBUTE_NAME

常量值: "run_target"

STATUS_RESOURCE_NAME

public static final String STATUS_RESOURCE_NAME

常量值: "status"

TEST_HARNESS_KEY

public static final String TEST_HARNESS_KEY

常量值: "test_harness"

公共构造函数

LabResourceDeviceMonitor

public LabResourceDeviceMonitor ()

公共方法

getLabResource

public void getLabResource (LabResourceRequest request, 
                StreamObserver<LabResource> responseObserver)

gRPC 请求处理程序。

参数
request LabResourceRequest

responseObserver StreamObserver

notifyDeviceStateChange

public void notifyDeviceStateChange (String serial, 
                DeviceAllocationState oldState, 
                DeviceAllocationState newState)

IDeviceMonitor 发出设备状态已更改的信号。 监控实现应限制在此方法中执行的处理和 IDeviceManager/DeviceLister 交互的数量。

参数
serial String

oldState DeviceAllocationState

newState DeviceAllocationState

得分

public void run ()

一种方法,将在设置完所有 Monitor 的 @Option 字段后调用。

setDeviceLister

public void setDeviceLister (IDeviceMonitor.DeviceLister lister)

允许设置 DeviceLister。成功尝试设置监听器后,实现可能会舍弃所有后续尝试。

参数
lister IDeviceMonitor.DeviceLister

停止

public void stop ()

需要在停止监控时调用的方法。

受保护的方法

getCachedLabResource

protected LabResource getCachedLabResource ()

返回
LabResource