ICommandScheduler
public
interface
ICommandScheduler
com.android.tradefed.command.ICommandScheduler |
用于运行 TradeFederation 命令的调度程序。
摘要
嵌套类 | |
---|---|
interface |
ICommandScheduler.IScheduledInvocationListener
用于监听调用完成时调用事件的监听器。 |
公共方法 | |
---|---|
abstract
boolean
|
addCommand(String[] args)
向调度程序添加命令。 |
abstract
void
|
addCommandFile(String cmdFile,
将给定文件中的所有命令添加到调度程序 |
abstract
void
|
await()
等待调度器开始运行,包括等待从旧 TF 完成接管(如果适用)。 |
abstract
void
|
completeHandover()
通知命令调度程序,已启动的接管序列已完全完成,它应在默认端口上重新初始化其远程管理器。 |
abstract
void
|
displayCommandQueue(PrintWriter printWriter)
输出有关命令执行队列状态的详细调试信息。 |
abstract
void
|
displayCommandsInfo(PrintWriter printWriter, String regex)
输出当前命令的列表。 |
abstract
void
|
displayInvocationsInfo(PrintWriter printWriter)
显示当前调用的列表。 |
abstract
void
|
dumpCommandsXml(PrintWriter printWriter, String regex)
转储包含为所有当前命令指定的所有 |
abstract
void
|
execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,而无需使用现有的 |
abstract
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,而无需将其添加到命令队列。 |
abstract
void
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
直接在已分配的设备上执行命令。 |
abstract
CommandFileWatcher
|
getCommandFileWatcher()
获取此调度程序的适当 |
abstract
int
|
getExecutingCommandCount()
返回处于执行状态的命令数量。 |
abstract
String
|
getInvocationInfo(int invocationId)
通过指定调用 ID 返回调用相关信息。 |
abstract
CommandRunner.ExitCode
|
getLastInvocationExitCode()
返回上次运行的调用的错误代码。 |
abstract
Throwable
|
getLastInvocationThrowable()
返回上次运行的调用中的 |
abstract
int
|
getReadyCommandCount()
返回队列中处于就绪状态的命令数量。 |
abstract
void
|
handoverInitiationComplete()
告知命令调度程序,正在使用的设备和命令的初始接管交换已完成,它可以开始调度操作。 |
abstract
boolean
|
handoverShutdown(int handoverPort)
启动 |
abstract
void
|
join()
等待调度程序完成。 |
abstract
void
|
join(long millis)
等待调度程序完成或在指定时长(以毫秒为单位)后超时。 |
abstract
void
|
removeAllCommands()
从调度程序中移除所有命令 |
abstract
void
|
setClearcutClient(ClearcutClient client)
将客户端设置为报告 harness 数据 |
abstract
boolean
|
shouldShutdownOnCmdfileError()
如果我们需要在出现命令错误时关闭调度程序,则返回 true |
abstract
void
|
shutdown()
尝试正常关闭命令调度程序。 |
abstract
void
|
shutdownHard(boolean killAdb)
尝试强制关闭命令调度程序。 |
abstract
void
|
shutdownHard()
尝试强制关闭命令调度程序。 |
abstract
void
|
shutdownOnEmpty()
与 |
abstract
void
|
start()
|
abstract
boolean
|
stopInvocation(int invocationId, String cause)
通过指定正在运行的调用的 ID 来停止该调用。 |
default
boolean
|
stopInvocation(int invocationId)
通过指定正在运行的调用的 ID 来停止该调用。 |
abstract
boolean
|
stopInvocation(ITestInvocation invocation)
停止正在运行的调用。 |
公共方法
addCommand
public abstract boolean addCommand (String[] args)
向调度程序添加命令。
命令本质上是要运行的配置及其关联参数的实例。
如果指定了“--help”参数,系统会将配置的帮助文本输出到标准输出。否则,系统会将配置添加到队列以进行运行。
参数 | |
---|---|
args |
String :配置参数。 |
返回 | |
---|---|
boolean |
如果命令已成功添加,则为 true |
抛出 | |
---|---|
ConfigurationException |
如果无法解析命令 |
addCommandFile
public abstract void addCommandFile (String cmdFile,extraArgs)
将给定文件中的所有命令添加到调度程序
参数 | |
---|---|
cmdFile |
String :命令文件的文件系统路径 |
extraArgs |
:要附加到从文件解析的每个命令的 String 参数的 ERROR(/List) 。可以为空,但不应为 null。 |
抛出 | |
---|---|
ConfigurationException |
如果无法解析命令文件 |
await
public abstract void await ()
等待调度器开始运行,包括等待从旧 TF 完成接管(如果适用)。
completeHandover
public abstract void completeHandover ()
通知命令调度程序,已启动的接管序列已完全完成,并且它应在默认端口上重新初始化其远程管理器。
displayCommandQueue
public abstract void displayCommandQueue (PrintWriter printWriter)
输出有关命令执行队列状态的详细调试信息。
displayCommandsInfo
public abstract void displayCommandsInfo (PrintWriter printWriter, String regex)
输出当前命令的列表。
参数 | |
---|---|
printWriter |
PrintWriter :要输出的 ERROR(/PrintWriter) 。 |
regex |
String :命令必须与此正则表达式匹配才能被输出。如果为 null,则会输出所有命令。
|
displayInvocationsInfo
public abstract void displayInvocationsInfo (PrintWriter printWriter)
显示当前调用的列表。
参数 | |
---|---|
printWriter |
PrintWriter :要输出的 ERROR(/PrintWriter) 。 |
dumpCommandsXml
public abstract void dumpCommandsXml (PrintWriter printWriter, String regex)
转储包含为所有当前命令指定的所有 Option
值的命令的展开式 XML 文件。
参数 | |
---|---|
printWriter |
PrintWriter :要将状态输出的 ERROR(/PrintWriter) 。 |
regex |
String :命令应与此正则表达式匹配,才能转储 XML 文件。如果为 null,则会转储所有命令。 |
execCommand
public abstract void execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,而无需使用现有的 IInvocationContext
将其添加到命令队列。
参数 | |
---|---|
context |
IInvocationContext :现有 IInvocationContext 。 |
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
args |
String :命令参数 |
抛出 | |
---|---|
ConfigurationException |
如果命令无效 |
NoDeviceException |
如果没有可用的设备 |
execCommand
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
直接分配设备并执行命令,而无需将其添加到命令队列。
参数 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
args |
String :命令参数 |
抛出 | |
---|---|
ConfigurationException |
如果命令无效 |
NoDeviceException |
如果没有可用的设备 |
execCommand
public abstract void execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
直接在已分配的设备上执行命令。
参数 | |
---|---|
listener |
ICommandScheduler.IScheduledInvocationListener :要通知的 ICommandScheduler.IScheduledInvocationListener |
device |
ITestDevice :要使用的 ITestDevice |
args |
String :命令参数 |
抛出 | |
---|---|
ConfigurationException |
如果命令无效 |
getCommandFileWatcher
public abstract CommandFileWatcher getCommandFileWatcher ()
获取适用于此调度程序的适当 CommandFileWatcher
返回 | |
---|---|
CommandFileWatcher |
getExecutingCommandCount
public abstract int getExecutingCommandCount ()
返回处于执行状态的命令数量。
返回 | |
---|---|
int |
getInvocationInfo
public abstract String getInvocationInfo (int invocationId)
通过指定调用 ID 返回调用相关信息。
参数 | |
---|---|
invocationId |
int :调用的跟踪 ID。 |
返回 | |
---|---|
String |
包含有关调用的 String 。 |
getLastInvocationExitCode
public abstract CommandRunner.ExitCode getLastInvocationExitCode ()
返回上次运行的调用的错误代码。 如果尚未运行任何调用,则返回 0(无错误)。
返回 | |
---|---|
CommandRunner.ExitCode |
getLastInvocationThrowable
public abstract Throwable getLastInvocationThrowable ()
返回上次运行的调用中的 Throwable
。如果没有可用的 throwable,则返回 null。
返回 | |
---|---|
Throwable |
getReadyCommandCount
public abstract int getReadyCommandCount ()
返回队列中处于就绪状态的命令数量。
返回 | |
---|---|
int |
handoverInitiationComplete
public abstract void handoverInitiationComplete ()
告知命令调度程序,正在使用的设备和命令的初始接管交换已完成,可以开始调度操作。
handoverShutdown
public abstract boolean handoverShutdown (int handoverPort)
启动 shutdown()
并将其交接给同一主机上的另一个 tradefed 进程。
调度程序会在有设备空闲时通知监听该端口的远程 tradefed 进程。
参数 | |
---|---|
handoverPort |
int |
返回 | |
---|---|
boolean |
如果手动发起切换成功,则为 true ;否则为 false
|
join
public abstract void join (long millis)
等待调度程序完成或在指定时长(以毫秒为单位)后超时。
参数 | |
---|---|
millis |
long |
removeAllCommands
public abstract void removeAllCommands ()
从调度程序中移除所有命令
setClearcutClient
public abstract void setClearcutClient (ClearcutClient client)
将客户端设置为报告 harness 数据
参数 | |
---|---|
client |
ClearcutClient |
shouldShutdownOnCmdfileError
public abstract boolean shouldShutdownOnCmdfileError ()
如果需要在出现命令错误时关闭调度程序,则返回 true
返回 | |
---|---|
boolean |
关机
public abstract void shutdown ()
尝试正常关闭命令调度程序。
清除等待测试的命令,并请求优雅关闭所有正在进行的调用。
调用 shutdown 后,调度程序主循环将等待所有正在进行的调用完成,然后再完全退出。
shutdownHard
public abstract void shutdownHard (boolean killAdb)
尝试强制关闭命令调度程序。
与 shutdown()
类似,但还会视需要终止 adb 连接,以便“激励”正在进行的调用更快完成。
参数 | |
---|---|
killAdb |
boolean |
shutdownHard
public abstract void shutdownHard ()
尝试强制关闭命令调度程序。与 shutdownHard(true) 相同。
shutdownOnEmpty
public abstract void shutdownOnEmpty ()
与 shutdown()
类似,但会在退出前等待所有命令执行完毕。
请注意,如果任何命令处于循环模式,调度程序将永远不会退出。
stopInvocation
public abstract boolean stopInvocation (int invocationId, String cause)
通过指定正在运行的调用的 ID 来停止该调用。
参数 | |
---|---|
invocationId |
int :调用的跟踪 ID。 |
cause |
String :停止调用的原因为何。 |
返回 | |
---|---|
boolean |
如果调用已停止,则为 true,否则为 false |
抛出 | |
---|---|
UnsupportedOperationException |
如果实现不支持此操作 |
stopInvocation
public boolean stopInvocation (int invocationId)
通过指定正在运行的调用的 ID 来停止该调用。
参数 | |
---|---|
invocationId |
int |
返回 | |
---|---|
boolean |
如果调用已停止,则为 true,否则为 false |
抛出 | |
---|---|
UnsupportedOperationException |
如果实现不支持此操作 |
stopInvocation
public abstract boolean stopInvocation (ITestInvocation invocation)
停止正在运行的调用。
参数 | |
---|---|
invocation |
ITestInvocation |
返回 | |
---|---|
boolean |
如果调用已停止,则为 true,否则为 false |
抛出 | |
---|---|
UnsupportedOperationException |
如果实现不支持此操作 |