ClusterClient

public class ClusterClient
extends Object implements IClusterClient

java.lang.Object
   ↳ com.android.tradefed.cluster.ClusterClient


A IClusterClient implementation for interacting with the TFC backend.

Summary

Public constructors

ClusterClient()

Public methods

IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader()

Get a IClusterEventUploader that can be used to upload ClusterCommandEvents.

ClusterCommand.State getCommandState(String requestId, String commandId)

Determine the state of a cluster command.

ClusterCommandStatus getCommandStatus(String requestId, String commandId)

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

IClusterEventUploader<ClusterHostEvent> getHostEventUploader()

Get a IClusterEventUploader that can be used to upload ClusterHostEvents.

TestContext getTestContext(String requestId, String commandId)

TestEnvironment getTestEnvironment(String requestId)

Get TestEnvironment for a request.

getTestResources(String requestId)

Get TestResources for a request.

leaseHostCommands(String clusterId, String hostname, deviceInfos, nextClusterIds, int maxTasksTolease)

Lease ClusterCommand for the give host.

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

Public constructors

ClusterClient

public ClusterClient ()

Public methods

getCommandEventUploader

public IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader ()

Get a IClusterEventUploader that can be used to upload ClusterCommandEvents.

Returns
IClusterEventUploader<ClusterCommandEvent>

getCommandState

public 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 IClusterEventUploader<ClusterHostEvent> getHostEventUploader ()

Get a IClusterEventUploader that can be used to upload ClusterHostEvents.

Returns
IClusterEventUploader<ClusterHostEvent>

getTestContext

public TestContext getTestContext (String requestId, 
                String commandId)

Parameters
requestId String

commandId String

Returns
TestContext

Throws
JSONException

getTestEnvironment

public TestEnvironment getTestEnvironment (String requestId)

Get TestEnvironment for a request.

Returns
TestEnvironment a TestEnvironment object.

Throws
JSONException

getTestResources

public  getTestResources (String requestId)

Get TestResources for a request.

Returns
a list of TestResource.

Throws
JSONException

leaseHostCommands

public  leaseHostCommands (String clusterId, 
                String hostname, 
                 deviceInfos, 
                 nextClusterIds, 
                int maxTasksTolease)

Lease ClusterCommand for the give host.

Parameters
clusterId String: cluster id for the host

hostname String: hostname

deviceInfos : 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 void updateTestContext (String requestId, 
                String commandId, 
                TestContext testContext)

Parameters
requestId String

commandId String

testContext TestContext

Throws
JSONException