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