ClusterClient

public class ClusterClient
extends Object implements IClusterClient

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


用于与 TFC 后端交互的 IClusterClient 实现。

摘要

公共构造函数

ClusterClient()

公共方法

IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader()

获取可用于上传 ClusterCommandEventIClusterEventUploader

ClusterCommand.State getCommandState(String requestId, String commandId)

确定集群命令的状态。

ClusterCommandStatus getCommandStatus(String requestId, String commandId)

获取集群命令的命令状态(状态和取消原因,如果已取消)。

IClusterEventUploader<ClusterHostEvent> getHostEventUploader()

获取可用于上传 ClusterHostEventIClusterEventUploader

TestContext getTestContext(String requestId, String commandId)

TestEnvironment getTestEnvironment(String requestId)

获取请求的 TestEnvironment

List<TestResource> getTestResources(String requestId)

获取请求的 TestResource

List<ClusterCommand> leaseHostCommands(String clusterId, String hostname, List<ClusterDeviceInfo> deviceInfos, List<String> nextClusterIds, int maxTasksTolease)

为给定主机租用 ClusterCommand

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

公共构造函数

ClusterClient

public ClusterClient ()

公共方法

getCommandEventUploader

public IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader ()

获取可用于上传 ClusterCommandEventIClusterEventUploader

返回
IClusterEventUploader<ClusterCommandEvent>

getCommandState

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

确定集群命令的状态。

参数
requestId String:集群请求 ID

commandId String:集群命令 ID

返回
ClusterCommand.State 集群命令的状态,如果无法确定状态,则为 ClusterCommand.State.UNKNOWN

getCommandStatus

public ClusterCommandStatus getCommandStatus (String requestId, 
                String commandId)

获取集群命令的命令状态(状态和取消原因,如果已取消)。

参数
requestId String:集群请求 ID

commandId String:集群命令 ID

返回
ClusterCommandStatus 一个 ClusterCommandStatus,表示状态和取消原因(如果命令 已取消)。如果无法确定状态,则状态为 ClusterCommand.State.UNKNOWN

getHostEventUploader

public IClusterEventUploader<ClusterHostEvent> getHostEventUploader ()

获取可用于上传 ClusterHostEventIClusterEventUploader

返回
IClusterEventUploader<ClusterHostEvent>

getTestContext

public TestContext getTestContext (String requestId, 
                String commandId)

参数
requestId String

commandId String

返回
TestContext

抛出
IOException
JSONException

getTestEnvironment

public TestEnvironment getTestEnvironment (String requestId)

获取请求的 TestEnvironment

返回
TestEnvironment TestEnvironment 对象。

抛出
IOException
JSONException

getTestResources

public List<TestResource> getTestResources (String requestId)

获取请求的 TestResource

返回
List<TestResource> TestResource 的列表。

抛出
IOException
JSONException

leaseHostCommands

public List<ClusterCommand> leaseHostCommands (String clusterId, 
                String hostname, 
                List<ClusterDeviceInfo> deviceInfos, 
                List<String> nextClusterIds, 
                int maxTasksTolease)

为给定主机租用 ClusterCommand

参数
clusterId String:主机的集群 ID

hostname String:主机名

deviceInfos List:主机拥有的 deviceInfos

nextClusterIds List:要从中租用命令的下一个集群 ID 的列表。

maxTasksTolease int:当前可租用的任务数量上限

返回
List<ClusterCommand> ClusterCommand 的列表

抛出
JSONException

updateTestContext

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

参数
requestId String

commandId String

testContext TestContext

抛出
IOException
JSONException