コマンドスケジューラ
public class CommandScheduler
extends Object
implements ICommandScheduler
java.lang.オブジェクト | |
↳ | com.android.tradefed.command.CommandScheduler |
利用可能なすべてのデバイスで TradeFederation コマンドを実行するためのスケジューラ。
実行時間の合計実行回数に基づいて、実行するコマンドの優先順位付けを試みます。たとえば、頻繁に実行されないコマンドや高速に実行されるコマンドは、長時間実行されるコマンドよりも優先されます。シャットダウンするまでバックグラウンドで永久に実行されます。まとめ
入れ子になったクラス | |
---|---|
enum | CommandScheduler.HostState ホストのさまざまなステータスの列挙型 |
パブリックコンストラクター | |
---|---|
CommandScheduler () |
パブリックメソッド | |
---|---|
boolean | addCommand (String[] args) スケジューラにコマンドを追加します。 |
void | addCommandFile (String cmdFilePath, extraArgs) addCommandFile (String cmdFilePath, extraArgs) 指定されたファイルのすべてのコマンドをスケジューラに追加します |
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) 現在のすべてのコマンドに指定されているすべての |
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, extraArgs) notifyFileChanged (File cmdFile, extraArgs) |
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 () すべての呼び出しスレッドが完了するまで待ちます。 |
パブリックコンストラクター
パブリックメソッド
addコマンド
public boolean addCommand (String[] args)
スケジューラにコマンドを追加します。
コマンドは基本的に、実行する構成とそれに関連する引数のインスタンスです。 「--help」引数を指定すると、設定のヘルプ テキストが標準出力に出力されます。それ以外の場合、構成は実行するキューに追加されます。パラメーター | |
---|---|
args | String : 構成引数。 |
戻り値 | |
---|---|
boolean | コマンドが正常に追加された場合はtrue |
投げる | |
---|---|
ConfigurationException |
addコマンドファイル
public void addCommandFile (String cmdFilePath,extraArgs)
指定されたファイルのすべてのコマンドをスケジューラに追加します
パラメーター | |
---|---|
cmdFilePath | String : コマンドファイルのファイルシステムパス |
extraArgs | String 引数のERROR(/List) 。空にすることもできますが、null にすることはできません。 |
投げる | |
---|---|
ConfigurationException |
待つ
public void await ()
古い TF からのハンドオーバーが完了するまで待機することも含めて、スケジューラの実行が開始されるまで待機します (該当する場合)。
check委任
public static TradefedDelegator checkDelegation (String[] args)
コマンド ラインに基づいてデリゲータを作成し、実行を委任する必要があるかどうかを確認します。
パラメーター | |
---|---|
args | String |
戻り値 | |
---|---|
TradefedDelegator |
投げる | |
---|---|
ConfigurationException |
完了ハンドオーバー
public void completeHandover ()
開始されたハンドオーバー シーケンスが完全に完了し、デフォルト ポートでリモート マネージャーを再初期化する必要があることをコマンド スケジューラに通知します。
リリースマップの作成
public staticcreateReleaseMap (IInvocationContext context, Throwable e)
デバイスを適切に解放できるように、デバイスの状態のマップを作成します。
パラメーター | |
---|---|
context | IInvocationContext |
e | Throwable |
戻り値 | |
---|---|
表示コマンドキュー
public void displayCommandQueue (PrintWriter printWriter)
コマンド実行キューの状態に関する詳細なデバッグ情報を出力します。
表示コマンド情報
public void displayCommandsInfo (PrintWriter printWriter, String regex)
現在のコマンドのリストを出力します。
パラメーター | |
---|---|
printWriter | PrintWriter : 出力先のERROR(/PrintWriter) 。 |
regex | String : 出力するためにコマンドを照合する必要がある正規表現。 null の場合、すべてのコマンドが出力されます。 |
表示呼び出し情報
public void displayInvocationsInfo (PrintWriter printWriter)
現在の呼び出しのリストを表示します。
パラメーター | |
---|---|
printWriter | PrintWriter : 出力先のERROR(/PrintWriter) 。 |
dumpCommandXml
public void dumpCommandsXml (PrintWriter printWriter, String regex)
現在のすべてのコマンドに指定されているすべてのOption
値を使用して、コマンドの展開された XML ファイルをダンプします。
パラメーター | |
---|---|
printWriter | PrintWriter : ステータスを出力するERROR(/PrintWriter) 。 |
regex | String : XML ファイルをダンプするためにコマンドを照合する必要がある正規表現。 null の場合、すべてのコマンドがダンプされます。 |
execコマンド
public void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
割り当て済みのデバイス上でコマンドを直接実行します。
パラメーター | |
---|---|
listener | ICommandScheduler.IScheduledInvocationListener : 通知されるICommandScheduler.IScheduledInvocationListener |
device | ITestDevice : 使用するITestDevice |
args | String : コマンド引数 |
投げる | |
---|---|
ConfigurationException |
execコマンド
public void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
既存のIInvocationContext
を使用して、デバイスをコマンド キューに追加せずに、デバイスを直接割り当ててコマンドを実行します。
パラメーター | |
---|---|
context | IInvocationContext : 既存のIInvocationContext 。 |
listener | ICommandScheduler.IScheduledInvocationListener : 通知されるICommandScheduler.IScheduledInvocationListener |
args | String : コマンド引数 |
投げる | |
---|---|
ConfigurationException | |
NoDeviceException |
execコマンド
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 |
ハンドオーバー開始完了
public void handoverInitiationComplete ()
使用中のデバイスとコマンドの初期ハンドオーバー交換が完了し、スケジュール操作を開始できることをコマンド スケジューラに通知します。
ハンドオーバーシャットダウン
public boolean handoverShutdown (int handoverPort)
shutdown()
を開始し、同じホスト上の別の tradefed プロセスにハンドオーバーします。
パラメーター | |
---|---|
handoverPort | int |
戻り値 | |
---|---|
boolean | ハンドオーバーの開始が成功した場合はtrue 、それ以外の場合はfalse |
通知ファイル変更
public void notifyFileChanged (File cmdFile,extraArgs)
パラメーター | |
---|---|
cmdFile | File |
extraArgs |
すべてのコマンドを削除
public void removeAllCommands ()
スケジューラからすべてのコマンドを削除します
走る
public void run ()
このスレッドのメイン実行ブロック。
setClearcutClient
public void setClearcutClient (ClearcutClient client)
ハーネス データをレポートするようにクライアントを設定する
パラメーター | |
---|---|
client | ClearcutClient |
shouldShutdownOnCmdfileError
public boolean shouldShutdownOnCmdfileError ()
コマンドエラー時にスケジューラをシャットダウンする必要がある場合は true を返します。
戻り値 | |
---|---|
boolean |
シャットダウン
public void shutdown ()
コマンド スケジューラを正常にシャットダウンしてみます。
テストを待機しているコマンドをクリアし、進行中のすべての呼び出しを正常にシャットダウンするように要求します。 shutdown が呼び出された後、スケジューラのメイン ループは進行中のすべての呼び出しが完了するまで待機してから、完全に終了します。シャットダウンハード
public void shutdownHard (boolean killAdb)
コマンドスケジューラを強制的にシャットダウンしてみます。
shutdown()
と似ていますが、進行中の呼び出しをより速く完了させるために、オプションで adb 接続を強制終了します。
パラメーター | |
---|---|
killAdb | boolean |
シャットダウンハード
public void shutdownHard ()
コマンドスケジューラを強制的にシャットダウンしてみます。 shutdownHard(true) と同じです。
shutdownOnEmpty
public void shutdownOnEmpty ()
shutdown()
と似ていますが、すべてのコマンドが実行されるまで待機してから終了します。
stop呼び出し
public boolean stopInvocation (ITestInvocation invocation)
実行中の呼び出しを停止します。
パラメーター | |
---|---|
invocation | ITestInvocation |
戻り値 | |
---|---|
boolean | 呼び出しが停止された場合は true、それ以外の場合は false |
stop呼び出し
public boolean stopInvocation (int invocationId, String cause)
ID を指定して実行中の呼び出しを停止します。
パラメーター | |
---|---|
invocationId | int : 呼び出しのトラッキング ID。 |
cause | String : 呼び出しを停止する原因。 |
戻り値 | |
---|---|
boolean | 呼び出しが停止された場合は true、それ以外の場合は false |
保護されたメソッド
掃除
protected void cleanUp ()
終了する前にログを閉じ、その他の必要なクリーンアップを実行します。
単体テストがモックできるように公開されています。
構成の作成
protected IConfiguration createConfiguration (String[] args)
パラメーター | |
---|---|
args | String |
戻り値 | |
---|---|
IConfiguration |
投げる | |
---|---|
ConfigurationException |
createInvocationContext
protected IInvocationContext createInvocationContext ()
戻り値 | |
---|---|
IInvocationContext |
getConfigFactory
protected IConfigurationFactory getConfigFactory ()
IConfigurationFactory
への参照を取得するためのファクトリ メソッド
戻り値 | |
---|---|
IConfigurationFactory | 使用するIConfigurationFactory |
getデバイスマネージャー
protected IDeviceManager getDeviceManager ()
IDeviceManager
への参照を取得するためのファクトリ メソッド
戻り値 | |
---|---|
IDeviceManager | 使用するIDeviceManager |
getHostOptions
protected IHostOptions getHostOptions ()
戻り値 | |
---|---|
IHostOptions |
getKeyStoreClient
protected IKeyStoreClient getKeyStoreClient ()
IGlobalConfiguration
で宣言されたIKeyStoreFactory
を使用してIKeyStoreClient
を取得します。何も定義されていない場合は null を取得します。
戻り値 | |
---|---|
IKeyStoreClient | IKeyStoreClient |
initLogging
protected void initLogging ()
ddmlib ログを初期化します。
単体テストがモックできるように公開されています。
シャットダウンです
protected boolean isShutdown ()
戻り値 | |
---|---|
boolean |
シャットダウン中です
protected boolean isShuttingDown ()
戻り値 | |
---|---|
boolean |
processReadyコマンド
protected void processReadyCommands (IDeviceManager manager)
パラメーター | |
---|---|
manager | IDeviceManager |
waitForAllInvocationThreads
protected void waitForAllInvocationThreads ()
すべての呼び出しスレッドが完了するまで待ちます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2023-12-01 UTC。