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 後,實作項目可能會捨棄所有後續嘗試。

參數
lister IDeviceMonitor.DeviceLister

停止

public void stop ()

需要停止監控器時要呼叫的方法。

受保護的方法

getCachedLabResource

protected LabResource getCachedLabResource ()

傳回
LabResource