Google is committed to advancing racial equity for Black communities. See how.

IClusterClient

public interface IClusterClient

com.android.tradefed.cluster.IClusterClient


An interface for interacting with the TFC backend.

Summary

Constants

String TYPE_NAME

The unique configuration object type name.

Public methods

abstract IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader()

Get a IClusterEventUploader that can be used to upload ClusterCommandEvents.

abstract ClusterCommand.State getCommandState(String requestId, String commandId)

Determine the state of a cluster command.

default ClusterCommandStatus getCommandStatus(String requestId, String commandId)

Get the command status of a cluster command (the state and the cancel reason if canceled).

abstract IClusterEventUploader<ClusterHostEvent> getHostEventUploader()

Get a IClusterEventUploader that can be used to upload ClusterHostEvents.

abstract TestContext getTestContext(String requestId, String commandId)
abstract TestEnvironment getTestEnvironment(String requestId)

Get TestEnvironment for a request.

abstract getTestResources(String requestId)

Get TestResources for a request.

abstract leaseHostCommands(String clusterId, String hostname, devices, nextClusterIds, int maxTasksTolease)

Lease ClusterCommand for the give host.

abstract void updateTestContext(String requestId, String commandId, TestContext testContext)

Constants

TYPE_NAME

public static final String TYPE_NAME

The unique configuration object type name. Used to retrieve the singleton instance from the GlobalConfiguration.

Constant Value: "cluster_client"

Public methods

getCommandEventUploader

public abstract IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader ()

Get a IClusterEventUploader that can be used to upload ClusterCommandEvents.

Returns
IClusterEventUploader<ClusterCommandEvent>

getCommandState

public abstract ClusterCommand.State getCommandState (String requestId, 
                String commandId)

Determine the state of a cluster command.

Parameters
requestId String: cluster request ID

commandId String: cluster command ID

Returns
ClusterCommand.State cluster command's state, or ClusterCommand.State#UNKNOWN if state could not be determined

getCommandStatus

public ClusterCommandStatus getCommandStatus (String requestId, 
                String commandId)

Get the command status of a cluster command (the state and the cancel reason if canceled).

Parameters
requestId String: cluster request ID

commandId String: cluster command ID

Returns
ClusterCommandStatus a ClusterCommandStatus that represents the state and the cancel reason if the command is canceled. The state is ClusterCommand.State#UNKNOWN if it could not be determined.

getHostEventUploader

public abstract IClusterEventUploader<ClusterHostEvent> getHostEventUploader ()

Get a IClusterEventUploader that can be used to upload ClusterHostEvents.

Returns
IClusterEventUploader<ClusterHostEvent>

getTestContext

public abstract TestContext getTestContext (String requestId, 
                String commandId)

Parameters
requestId String

commandId String

Returns
TestContext

Throws
JSONException

getTestEnvironment

public abstract TestEnvironment getTestEnvironment (String requestId)

Get TestEnvironment for a request.

Returns
TestEnvironment a TestEnvironment object.

Throws
IOException
JSONException

getTestResources

public abstract  getTestResources (String requestId)

Get TestResources for a request.

Returns
a list of TestResource.

Throws
IOException
JSONException

leaseHostCommands

public abstract  leaseHostCommands (String clusterId, 
                String hostname, 
                 devices, 
                 nextClusterIds, 
                int maxTasksTolease)

Lease ClusterCommand for the give host.

Parameters
clusterId String: cluster id for the host

hostname String: hostname

devices : deviceInfos the host has

nextClusterIds : a list of next cluster IDs to lease commands from.

maxTasksTolease int: the max number of tasks that can current be leased

Returns
a list of ClusterCommand

Throws
JSONException

updateTestContext

public abstract void updateTestContext (String requestId, 
                String commandId, 
                TestContext testContext)

Parameters
requestId String

commandId String

testContext TestContext

Throws
JSONException