CommandScheduler
public
class
CommandScheduler
extends Object
implements
ICommandScheduler
java.lang.Object | |
↳ | com.android.tradefed.command.CommandScheduler |
利用可能なすべてのデバイスで TradeFederation コマンドを実行するためのスケジューラ。
実行の合計実行回数に基づいて、実行するコマンドの優先順位付けを試みます あります。例:実行頻度の低いコマンドや高速に実行されるコマンドは、長時間実行されるコマンドよりも優先されます。
シャットダウンするまでバックグラウンドで永続的に動作します。
概要
ネストされたクラス | |
---|---|
enum |
CommandScheduler.HostState
ホストのさまざまなステータスの列挙型 |
パブリック コンストラクタ | |
---|---|
CommandScheduler()
|
パブリック メソッド | |
---|---|
boolean
|
addCommand(String[] args)
スケジューラにコマンドを追加します。 |
void
|
addCommandFile(String cmdFilePath,
指定されたファイルのすべてのコマンドをスケジューラに追加する |
void
|
await()
古い TF からのハンドオーバーの完了を待つなど、スケジューラの実行開始を待機する 。 |
static
TradefedDelegator
|
checkDelegation(String[] args)
コマンドラインに基づいて委任者を作成し、実行を委任する必要があるかどうかを確認します。 |
void
|
completeHandover()
開始されたハンドオーバー シーケンスが完全に完了したことをコマンド スケジューラに通知し、 デフォルト ポートでリモート マネージャーを再初期化する必要があります。 |
static
|
createReleaseMap(IInvocationContext context, Throwable e)
デバイスの状態のマップを作成して、デバイスを適切に解放できるようにします。 |
ISandbox
|
createSandbox()
呼び出しの実行に使用する |
void
|
displayCommandQueue(PrintWriter printWriter)
コマンド実行キューの状態に関する詳細なデバッグ情報を出力します。 |
void
|
displayCommandsInfo(PrintWriter printWriter, String regex)
現在のコマンドのリストを出力します。 |
void
|
displayInvocationsInfo(PrintWriter printWriter)
現在の呼び出しのリストを表示します。 |
void
|
dumpCommandsXml(PrintWriter printWriter, String regex)
コマンドの拡張 xml ファイルをダンプする
現在のすべてのコマンドに指定された |
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
すでに割り当てられているデバイスでコマンドを直接実行します。 |
void
|
execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
デバイスを直接割り当て、コマンドキューに追加せずにコマンドを実行する
既存の |
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)
デバイスを直接割り当てて、コマンドキューに追加せずにコマンドを実行します。 |
CommandFileWatcher
|
getCommandFileWatcher()
このスケジューラに適した |
int
|
getExecutingCommandCount()
実行状態のコマンドの数を返します。 |
CommandScheduler.HostState
|
getHostState()
|
String
|
getInvocationInfo(int invocationId)
呼び出し ID を指定して呼び出し bu の情報を返します。 |
CommandRunner.ExitCode
|
getLastInvocationExitCode()
最後に実行された呼び出しのエラーコードを返します。 |
Throwable
|
getLastInvocationThrowable()
最後に実行された呼び出しから |
int
|
getReadyCommandCount()
キュー内の準備完了状態のコマンドの数を返します。 |
long
|
getShutdownTimeout()
|
void
|
handoverInitiationComplete()
使用中のデバイスとコマンドの初期ハンドオーバー交換をコマンド スケジューラに通知する オペレーションのスケジューリングを開始できます。 |
boolean
|
handoverShutdown(int handoverPort)
|
void
|
notifyFileChanged(File cmdFile,
|
void
|
removeAllCommands()
スケジューラからすべてのコマンドを削除 |
void
|
run()
このスレッドのメイン実行ブロック。 |
void
|
setClearcutClient(ClearcutClient client)
ハーネスデータを報告するようにクライアントを設定する |
boolean
|
shouldShutdownOnCmdfileError()
コマンドエラーでスケジューラをシャットダウンする必要がある場合は true を返す |
void
|
shutdown()
コマンド スケジューラを正常にシャットダウンしてみます。 |
void
|
shutdownHard(boolean killAdb)
コマンド スケジューラの強制シャットダウンを試みます。 |
void
|
shutdownHard()
コマンド スケジューラの強制シャットダウンを試みます。 |
void
|
shutdownOnEmpty()
|
void
|
start()
ロギングの設定や |
boolean
|
stopInvocation(ITestInvocation invocation)
実行中の呼び出しを停止します。 |
boolean
|
stopInvocation(int invocationId, String cause)
ID を指定して実行中の呼び出しを停止します。 |
保護されたメソッド | |
---|---|
void
|
cleanUp()
ログを閉じて、必要なクリーンアップを行ってから終了します。 |
IConfiguration
|
createConfiguration(String[] args)
|
IInvocationContext
|
createInvocationContext()
|
IConfigurationFactory
|
getConfigFactory()
|
IDeviceManager
|
getDeviceManager()
|
TradefedFeatureServer
|
getFeatureServer()
|
IHostOptions
|
getHostOptions()
|
IKeyStoreClient
|
getKeyStoreClient()
|
void
|
initLogging()
ddmlib ログを初期化します。 |
boolean
|
isShutdown()
|
boolean
|
isShuttingDown()
|
void
|
processReadyCommands(IDeviceManager manager)
|
void
|
waitForAllInvocationThreads()
すべての呼び出しスレッドが完了するまで待ちます。 |
パブリック コンストラクタ
パブリック メソッド
addCommand
public boolean addCommand (String[] args)
スケジューラにコマンドを追加します。
コマンドは基本的に、実行する構成のインスタンスとそれに関連する引数です。
「--help」の場合引数には、指定されたロールと 構成は stdout に出力されます。それ以外の場合は、構成がキューに追加され、 あります。
パラメータ | |
---|---|
args |
String : 構成引数。 |
戻り値 | |
---|---|
boolean |
コマンドが正常に追加された場合は true |
例外 | |
---|---|
ConfigurationException |
addCommandFile
public void addCommandFile (String cmdFilePath,extraArgs)
指定されたファイルのすべてのコマンドをスケジューラに追加する
パラメータ | |
---|---|
cmdFilePath |
String : コマンド ファイルのファイル システム パス |
extraArgs |
: 解析された各コマンドに追加する String 引数の ERROR(/List)
おすすめします。空にすることもできますが、null にすることはできません。 |
例外 | |
---|---|
ConfigurationException |
待って
public void await ()
古い TF からのハンドオーバーの完了を待つなど、スケジューラの実行開始を待機する 。
checkDelegation
public static TradefedDelegator checkDelegation (String[] args)
コマンドラインに基づいて委任者を作成し、実行を委任する必要があるかどうかを確認します。
パラメータ | |
---|---|
args |
String |
戻り値 | |
---|---|
TradefedDelegator |
例外 | |
---|---|
ConfigurationException |
引き渡しの完了
public void completeHandover ()
開始されたハンドオーバー シーケンスが完全に完了したことをコマンド スケジューラに通知し、 デフォルト ポートでリモート マネージャーを再初期化する必要があります。
createReleaseMap
public staticcreateReleaseMap (IInvocationContext context, Throwable e)
デバイスの状態のマップを作成して、デバイスを適切に解放できるようにします。
パラメータ | |
---|---|
context |
IInvocationContext |
e |
Throwable |
戻り値 | |
---|---|
|
displayCommandQueue
public void displayCommandQueue (PrintWriter printWriter)
コマンド実行キューの状態に関する詳細なデバッグ情報を出力します。
displayCommandsInfo
public void displayCommandsInfo (PrintWriter printWriter, String regex)
現在のコマンドのリストを出力します。
パラメータ | |
---|---|
printWriter |
PrintWriter : 出力先の ERROR(/PrintWriter) 。 |
regex |
String : コマンドを照合する正規表現
表示されます。null の場合、すべてのコマンドが出力されます。
|
displayInvocationsInfo
public void displayInvocationsInfo (PrintWriter printWriter)
現在の呼び出しのリストを表示します。
パラメータ | |
---|---|
printWriter |
PrintWriter : 出力先の ERROR(/PrintWriter) 。
|
dumpCommandsXml
public void dumpCommandsXml (PrintWriter printWriter, String regex)
コマンドの拡張 xml ファイルをダンプする
現在のすべてのコマンドに指定された Option
値。
パラメータ | |
---|---|
printWriter |
PrintWriter : ステータスの出力先の ERROR(/PrintWriter) 。 |
regex |
String :
ダンプする xml ファイルを指定します。null の場合、すべてのコマンドがダンプされます。
|
execCommand
public void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
すでに割り当てられているデバイスでコマンドを直接実行します。
パラメータ | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener : 通知対象の ICommandScheduler.IScheduledInvocationListener |
device |
ITestDevice : 使用する ITestDevice |
args |
String : コマンド引数 |
例外 | |
---|---|
ConfigurationException |
execCommand
public void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
デバイスを直接割り当て、コマンドキューに追加せずにコマンドを実行する
既存の IInvocationContext
を使用します。
パラメータ | |
---|---|
context |
IInvocationContext : 既存の IInvocationContext 。 |
listener |
ICommandScheduler.IScheduledInvocationListener : 通知対象の ICommandScheduler.IScheduledInvocationListener |
args |
String : コマンド引数 |
例外 | |
---|---|
ConfigurationException |
|
NoDeviceException |
execCommand
public void execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
デバイスを直接割り当てて、コマンドキューに追加せずにコマンドを実行します。
パラメータ | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener : 通知対象の ICommandScheduler.IScheduledInvocationListener |
args |
String : コマンド引数 |
例外 | |
---|---|
ConfigurationException |
|
NoDeviceException |
getCommandFileWatcher
public CommandFileWatcher getCommandFileWatcher ()
このスケジューラに適した CommandFileWatcher
を取得する
戻り値 | |
---|---|
CommandFileWatcher |
getExecutingCommandCount
public int getExecutingCommandCount ()
実行状態のコマンドの数を返します。
戻り値 | |
---|---|
int |
getInvocationInfo
public String getInvocationInfo (int invocationId)
呼び出し ID を指定して呼び出し bu の情報を返します。
パラメータ | |
---|---|
invocationId |
int : 呼び出しのトラッキング ID。 |
戻り値 | |
---|---|
String |
呼び出しに関する情報を含む String 。
|
getLastInvocationExitCode
public CommandRunner.ExitCode getLastInvocationExitCode ()
最後に実行された呼び出しのエラーコードを返します。 呼び出しがまだ実行されていない場合は、0(エラーなし)を返します。
戻り値 | |
---|---|
CommandRunner.ExitCode |
getLastInvocationThrowable
public Throwable getLastInvocationThrowable ()
最後に実行された呼び出しから Throwable
を返します。
スローアブルが利用できない場合は null を返します。
戻り値 | |
---|---|
Throwable |
getReadyCommandCount
public int getReadyCommandCount ()
キュー内の準備完了状態のコマンドの数を返します。
戻り値 | |
---|---|
int |
getShutdownTimeout
public long getShutdownTimeout ()
戻り値 | |
---|---|
long |
HandoverInitiationComplete
public void handoverInitiationComplete ()
使用中のデバイスとコマンドの初期ハンドオーバー交換をコマンド スケジューラに通知する オペレーションのスケジューリングを開始できます。
handshake シャットダウン
public boolean handoverShutdown (int handoverPort)
shutdown()
を開始し、この同じホスト上の別の tradefed プロセスにハンドオーバーします。
スケジューラは、解放されたデバイスのそのポートをリッスンしているリモート tradefed プロセスに通知します。 自動的に適用されます。
パラメータ | |
---|---|
handoverPort |
int |
戻り値 | |
---|---|
boolean |
ハンドオーバーの開始が成功した場合は true 、false
|
notifyFileChanged
public void notifyFileChanged (File cmdFile,extraArgs)
パラメータ | |
---|---|
cmdFile |
File |
extraArgs |
|
deleteAllCommands
public void removeAllCommands ()
スケジューラからすべてのコマンドを削除
ホームラン
public void run ()
このスレッドのメイン実行ブロック。
setClearcutClient
public void setClearcutClient (ClearcutClient client)
ハーネスデータを報告するようにクライアントを設定する
パラメータ | |
---|---|
client |
ClearcutClient |
shouldShutdownOnCmdfileError エラー
public boolean shouldShutdownOnCmdfileError ()
コマンドエラーでスケジューラをシャットダウンする必要がある場合は true を返す
戻り値 | |
---|---|
boolean |
シャットダウン
public void shutdown ()
コマンド スケジューラを正常にシャットダウンしてみます。
テストを待機しているコマンドを消去し、進行中のすべての呼び出しを要求する 正常にシャットダウンします。
シャットダウンが呼び出されると、スケジューラのメインループは、進行中のすべての呼び出しを待機します。 完了するまで待つ必要はありません
shutdownHard
public void shutdownHard (boolean killAdb)
コマンド スケジューラの強制シャットダウンを試みます。
shutdown()
に似ていますが、必要に応じて
「インスピレーション」をより迅速に完了できるようになります。
パラメータ | |
---|---|
killAdb |
boolean |
shutdownHard
public void shutdownHard ()
コマンド スケジューラの強制シャットダウンを試みます。shutdownHard(true) と同じです。
shutdownOnEmpty
public void shutdownOnEmpty ()
shutdown()
に似ていますが、すべてのコマンドの実行を待機します。
終了です。
いずれかのコマンドがループモードの場合、スケジューラは終了しません。
stopInvocation
public boolean stopInvocation (ITestInvocation invocation)
実行中の呼び出しを停止します。
パラメータ | |
---|---|
invocation |
ITestInvocation |
戻り値 | |
---|---|
boolean |
呼び出しが停止した場合は true、それ以外の場合は false |
stopInvocation
public boolean stopInvocation (int invocationId, String cause)
ID を指定して実行中の呼び出しを停止します。
パラメータ | |
---|---|
invocationId |
int : 呼び出しのトラッキング ID。 |
cause |
String : 呼び出しを停止する原因。 |
戻り値 | |
---|---|
boolean |
呼び出しが停止した場合は true、それ以外の場合は false |
保護されたメソッド
クリーンアップ
protected void cleanUp ()
ログを閉じて、必要なクリーンアップを行ってから終了します。
単体テストがモックできるように公開されています。
createConfiguration
protected IConfiguration createConfiguration (String[] args)
パラメータ | |
---|---|
args |
String |
戻り値 | |
---|---|
IConfiguration |
例外 | |
---|---|
ConfigurationException |
createInvocationContext
protected IInvocationContext createInvocationContext ()
戻り値 | |
---|---|
IInvocationContext |
getConfigFactory
protected IConfigurationFactory getConfigFactory ()
IConfigurationFactory
への参照を取得するためのファクトリ メソッド
戻り値 | |
---|---|
IConfigurationFactory |
使用する IConfigurationFactory
|
getDeviceManager
protected IDeviceManager getDeviceManager ()
IDeviceManager
への参照を取得するためのファクトリ メソッド
戻り値 | |
---|---|
IDeviceManager |
使用する IDeviceManager
|
getHostOptions
protected IHostOptions getHostOptions ()
戻り値 | |
---|---|
IHostOptions |
getKeyStoreClient
protected IKeyStoreClient getKeyStoreClient ()
IKeyStoreFactory
を使用して IKeyStoreClient
を取得します。
IGlobalConfiguration
で宣言されます。何も定義されていない場合は null になります。
戻り値 | |
---|---|
IKeyStoreClient |
IKeyStoreClient |
initLogging
protected void initLogging ()
ddmlib ログを初期化します。
単体テストがモックできるように公開されています。
isShutdown
protected boolean isShutdown ()
戻り値 | |
---|---|
boolean |
isShuttingDown
protected boolean isShuttingDown ()
戻り値 | |
---|---|
boolean |
processReadyCommands
protected void processReadyCommands (IDeviceManager manager)
パラメータ | |
---|---|
manager |
IDeviceManager |
waitForAllInvocationThreads
protected void waitForAllInvocationThreads ()
すべての呼び出しスレッドが完了するまで待ちます。