LabResourceDeviceMonitor

public class LabResourceDeviceMonitor
extends LabResourceServiceGrpc.LabResourceServiceImplBase implements IDeviceMonitor

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


The lab resource monitor which initializes/manages the gRPC server for LabResourceService. To add resource metric collectors, please add resource_metric_collector tags in global configuration to load the collectors.

Summary

Constants

int DEFAULT_PORT

int DEFAULT_THREAD_COUNT

float FIXED_METRIC_VALUE

Fields

public static final String DEVICE_SERIAL_KEY

public static final String HARDWARE_REVISION_RESOURCE_NAME

public static final String HARNESS_VERSION_KEY

public static final String HOST_GROUP_KEY

public static final String HOST_NAME_KEY

public static final String LAB_NAME_KEY

public static final String POOL_ATTRIBUTE_NAME

public static final String RUN_TARGET_ATTRIBUTE_NAME

public static final String STATUS_RESOURCE_NAME

public static final String TEST_HARNESS_KEY

Public constructors

LabResourceDeviceMonitor()

Public methods

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

The gRPC request handler.

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

Signals the IDeviceMonitor that a device state has been changed.

void run()

A method that will be called after all of the Monitor's @Option fields have been set.

void setDeviceLister(IDeviceMonitor.DeviceLister lister)

Allows the DeviceLister to be set.

void stop()

A method that will be called when the Monitor need to be stopped.

Protected methods

LabResource getCachedLabResource()

Constants

DEFAULT_PORT

public static final int DEFAULT_PORT

Constant Value: 8887 (0x000022b7)

DEFAULT_THREAD_COUNT

public static final int DEFAULT_THREAD_COUNT

Constant Value: 1 (0x00000001)

FIXED_METRIC_VALUE

public static final float FIXED_METRIC_VALUE

Constant Value: 1.0

Fields

DEVICE_SERIAL_KEY

public static final String DEVICE_SERIAL_KEY

HARDWARE_REVISION_RESOURCE_NAME

public static final String HARDWARE_REVISION_RESOURCE_NAME

HARNESS_VERSION_KEY

public static final String HARNESS_VERSION_KEY

HOST_GROUP_KEY

public static final String HOST_GROUP_KEY

HOST_NAME_KEY

public static final String HOST_NAME_KEY

LAB_NAME_KEY

public static final String LAB_NAME_KEY

POOL_ATTRIBUTE_NAME

public static final String POOL_ATTRIBUTE_NAME

RUN_TARGET_ATTRIBUTE_NAME

public static final String RUN_TARGET_ATTRIBUTE_NAME

STATUS_RESOURCE_NAME

public static final String STATUS_RESOURCE_NAME

TEST_HARNESS_KEY

public static final String TEST_HARNESS_KEY

Public constructors

LabResourceDeviceMonitor

public LabResourceDeviceMonitor ()

Public methods

getLabResource

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

The gRPC request handler.

Parameters
request LabResourceRequest

responseObserver StreamObserver

notifyDeviceStateChange

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

Signals the IDeviceMonitor that a device state has been changed. Monitor implementations should limit the amount of processing and IDeviceManager/DeviceLister interaction they do in this method.

Parameters
serial String

oldState DeviceAllocationState

newState DeviceAllocationState

run

public void run ()

A method that will be called after all of the Monitor's @Option fields have been set.

setDeviceLister

public void setDeviceLister (IDeviceMonitor.DeviceLister lister)

Allows the DeviceLister to be set. After a successful attempt to set the Lister, implementations may discard all subsequent attempts.

Parameters
lister IDeviceMonitor.DeviceLister

stop

public void stop ()

A method that will be called when the Monitor need to be stopped.

Protected methods

getCachedLabResource

protected LabResource getCachedLabResource ()

Returns
LabResource