CommandScheduler
public
class
CommandScheduler
extends Object
implements
ICommandScheduler
| java.lang.Object | |
| ↳ | com.android.tradefed.command.CommandScheduler |
사용 가능한 모든 기기에서 TradeFederation 명령어를 실행하는 스케줄러입니다.
실행 시간의 총 실행 횟수를 기반으로 실행할 명령어의 우선순위를 지정하려고 시도합니다. 예를 들어 자주 실행되지 않거나 빠르게 실행되는 명령어의 우선순위가 오래 실행되는 명령어보다 높습니다.
종료될 때까지 백그라운드에서 영구적으로 실행됩니다.
요약
공개 생성자 | |
|---|---|
CommandScheduler()
|
|
공개 메서드 | |
|---|---|
Pair<Boolean, Integer>
|
addCommand(String[] args)
스케줄러에 명령어를 추가합니다. |
void
|
addCommandFile(String cmdFilePath,
지정된 파일의 모든 명령어를 스케줄러에 추가 |
void
|
await()
이전 TF에서 핸드오버가 완료되기를 기다리는 등 스케줄러가 실행되기를 기다립니다(해당하는 경우). |
static
TradefedDelegator
|
checkDelegation(String[] args)
명령줄을 기반으로 위임자를 만들어 실행을 위임해야 하는지 확인합니다. |
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)
모든 현재 명령어에 지정된 모든 |
long
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
이미 할당된 기기에서 명령어를 직접 실행합니다. |
long
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener,
이미 할당된 기기에서 명령어를 직접 실행합니다. |
long
|
execCommand(IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
이미 있는 |
long
|
execCommand(ICommandScheduler.IScheduledInvocationListener listener, String[] args)
명령어 대기열에 추가하지 않고 기기를 직접 할당하고 명령어를 실행합니다. |
CommandFileWatcher
|
getCommandFileWatcher()
이 스케줄러에 적합한 CommandFileWatcher 가져오기 |
int
|
getExecutingCommandCount()
실행 상태의 명령어 수를 반환합니다. |
CommandScheduler.HostState
|
getHostState()
|
String
|
getInvocationInfo(int invocationId)
호출 ID를 지정하여 호출에 관한 정보를 반환합니다. |
CommandRunner.ExitCode
|
getLastInvocationExitCode()
실행된 마지막 호출의 오류 코드를 반환합니다. |
Throwable
|
getLastInvocationThrowable()
실행된 마지막 호출에서 |
int
|
getReadyCommandCount()
대기열에서 준비 상태인 명령의 수를 반환합니다. |
long
|
getShutdownTimeout()
|
boolean
|
isDeviceInInvocationThread(ITestDevice device)
활성 호출 스레드에서 기기를 사용하는 경우 true를 반환합니다. |
boolean
|
isShuttingDown()
|
void
|
notifyFileChanged(File cmdFile,
|
void
|
removeAllCommands()
스케줄러에서 모든 명령어 삭제 |
void
|
run()
이 스레드의 기본 실행 블록입니다. |
void
|
setClearcutClient(ClearcutClient client)
하네스 데이터를 보고하도록 클라이언트 설정 |
void
|
setMaxPollTime(long polling)
|
void
|
setPrintSchedulingWarning(boolean print)
|
boolean
|
shouldShutdownOnCmdfileError()
명령어 오류 시 스케줄러를 종료해야 하는 경우 true를 반환합니다. |
void
|
shutdown(boolean notifyStop)
명령어 스케줄러를 단계적으로 종료하려고 시도합니다. |
void
|
shutdownHard(boolean killAdb)
명령어 스케줄러를 강제 종료하려고 시도합니다. |
void
|
shutdownHard()
명령어 스케줄러를 강제 종료하려고 시도합니다. |
void
|
shutdownOnEmpty()
|
void
|
start()
로깅 설정, |
boolean
|
stopInvocation(ITestInvocation invocation)
실행 중인 호출을 중지합니다. |
boolean
|
stopInvocation(int invocationId, String cause)
ID를 지정하여 실행 중인 호출을 중지합니다. |
void
|
stopScheduling()
새 테스트의 예약 및 수락을 중지하지만 Tradefed는 중지하지 않습니다. |
공개 생성자
공개 메서드
addCommand
public Pair<Boolean, Integer> addCommand (String[] args)
스케줄러에 명령어를 추가합니다.
명령어는 기본적으로 실행할 구성과 연결된 인스턴스입니다.
'--help' 인수가 지정되면 구성에 대한 도움말 텍스트가 stdout에 출력됩니다. 그렇지 않으면 실행할 구성이 대기열에 추가됩니다.
| 매개변수 | |
|---|---|
args |
String: 구성 인수입니다. |
| 반환 값 | |
|---|---|
Pair<Boolean, Integer> |
값 쌍입니다. 첫 번째 값은 명령어가 성공적으로 추가된 경우 불리언 true입니다. 두 번째 값은 명령어가 성공적으로 추가된 경우 알려진 명령 추적기 ID(음수가 아닌 값)입니다. 명령어가 모든 기기에 추가된 경우 0을 반환하고 그렇지 않으면 -1을 반환합니다. |
| 생성 값 | |
|---|---|
ConfigurationException |
|
addCommandFile
public void addCommandFile (String cmdFilePath,
extraArgs) 지정된 파일의 모든 명령어를 스케줄러에 추가
| 매개변수 | |
|---|---|
cmdFilePath |
String: 명령 파일의 파일 시스템 경로 |
extraArgs |
: 파일에서 파싱된 각 명령어에 추가할 String 인수의 ERROR(/List)입니다. 비어 있을 수 있지만 null이어서는 안 됩니다. |
| 생성 값 | |
|---|---|
ConfigurationException |
|
await
public void await ()
이전 TF에서 핸드오버가 완료되기를 기다리는 등 스케줄러가 실행되기를 기다립니다(해당하는 경우).
checkDelegation
public static TradefedDelegator checkDelegation (String[] args)
명령줄을 기반으로 위임자를 만들어 실행을 위임해야 하는지 확인합니다.
| 매개변수 | |
|---|---|
args |
String |
| 반환 값 | |
|---|---|
TradefedDelegator |
|
| 생성 값 | |
|---|---|
|
com.android.tradefed.config.ConfigurationException |
ConfigurationException |
|
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)모든 현재 명령어에 지정된 모든 Option 값을 사용하여 명령어의 확장된 xml 파일을 덤프합니다.
| 매개변수 | |
|---|---|
printWriter |
PrintWriter: 상태를 출력할 ERROR(/PrintWriter)입니다. |
regex |
String: XML 파일을 덤프하기 위해 명령어가 일치해야 하는 정규 표현식입니다. null인 경우 모든 명령어가 덤프됩니다. |
execCommand
public long execCommand (ICommandScheduler.IScheduledInvocationListener listener, ITestDevice device, String[] args)
이미 할당된 기기에서 명령어를 직접 실행합니다.
| 매개변수 | |
|---|---|
listener |
ICommandScheduler.IScheduledInvocationListener: 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
device |
ITestDevice: 사용할 ITestDevice |
args |
String: 명령어 인수 |
| 반환 값 | |
|---|---|
long |
예약된 명령어의 호출 ID입니다. |
| 생성 값 | |
|---|---|
ConfigurationException |
|
execCommand
public long execCommand (ICommandScheduler.IScheduledInvocationListener listener,reservedDevices, String[] args)
이미 할당된 기기에서 명령어를 직접 실행합니다.
| 매개변수 | |
|---|---|
listener |
ICommandScheduler.IScheduledInvocationListener: 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
reservedDevices |
: 사용할 ERROR(/List |
args |
String: 명령어 인수 |
| 반환 값 | |
|---|---|
long |
예약된 명령어의 호출 ID입니다. |
| 생성 값 | |
|---|---|
ConfigurationException |
|
execCommand
public long execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
이미 있는 IInvocationContext를 사용하여 명령어를 명령 대기열에 추가하지 않고 기기를 직접 할당하고 명령어를 실행합니다.
| 매개변수 | |
|---|---|
context |
IInvocationContext: 기존 IInvocationContext |
listener |
ICommandScheduler.IScheduledInvocationListener: 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
args |
String: 명령어 인수 |
| 반환 값 | |
|---|---|
long |
|
| 생성 값 | |
|---|---|
ConfigurationException |
|
NoDeviceException |
|
execCommand
public long execCommand (ICommandScheduler.IScheduledInvocationListener listener, String[] args)
명령어 대기열에 추가하지 않고 기기를 직접 할당하고 명령어를 실행합니다.
| 매개변수 | |
|---|---|
listener |
ICommandScheduler.IScheduledInvocationListener: 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
args |
String: 명령어 인수 |
| 반환 값 | |
|---|---|
long |
예약된 명령어의 호출 ID입니다. |
| 생성 값 | |
|---|---|
ConfigurationException |
|
NoDeviceException |
|
getCommandFileWatcher
public CommandFileWatcher getCommandFileWatcher ()
이 스케줄러에 적합한 CommandFileWatcher 가져오기
| 반환 값 | |
|---|---|
CommandFileWatcher |
|
getExecutingCommandCount
public int getExecutingCommandCount ()
실행 상태의 명령어 수를 반환합니다.
| 반환 값 | |
|---|---|
int |
|
getInvocationInfo
public String getInvocationInfo (int invocationId)
호출 ID를 지정하여 호출에 관한 정보를 반환합니다.
| 매개변수 | |
|---|---|
invocationId |
int: 호출의 추적 ID입니다. |
| 반환 값 | |
|---|---|
String |
호출에 관한 정보가 포함된 String |
getLastInvocationExitCode
public CommandRunner.ExitCode getLastInvocationExitCode ()
실행된 마지막 호출의 오류 코드를 반환합니다. 아직 호출이 실행되지 않은 경우 0 (오류 없음)을 반환합니다.
| 반환 값 | |
|---|---|
CommandRunner.ExitCode |
|
getLastInvocationThrowable
public Throwable getLastInvocationThrowable ()
실행된 마지막 호출에서 Throwable를 반환합니다.
throwable을 사용할 수 없는 경우 null을 반환합니다.
| 반환 값 | |
|---|---|
Throwable |
|
getReadyCommandCount
public int getReadyCommandCount ()
대기열에서 준비 상태인 명령의 수를 반환합니다.
| 반환 값 | |
|---|---|
int |
|
getShutdownTimeout
public long getShutdownTimeout ()
| 반환 값 | |
|---|---|
long |
|
isDeviceInInvocationThread
public boolean isDeviceInInvocationThread (ITestDevice device)
활성 호출 스레드에서 기기를 사용하는 경우 true를 반환합니다.
| 매개변수 | |
|---|---|
device |
ITestDevice |
| 반환 값 | |
|---|---|
boolean |
|
isShuttingDown
public boolean isShuttingDown ()
| 반환 값 | |
|---|---|
boolean |
|
notifyFileChanged
public void notifyFileChanged (File cmdFile,
extraArgs) | 매개변수 | |
|---|---|
cmdFile |
File |
extraArgs |
|
removeAllCommands
public void removeAllCommands ()
스케줄러에서 모든 명령어 삭제
실행
public void run ()
이 스레드의 기본 실행 블록입니다.
setClearcutClient
public void setClearcutClient (ClearcutClient client)
하네스 데이터를 보고하도록 클라이언트 설정
| 매개변수 | |
|---|---|
client |
ClearcutClient |
setMaxPollTime
public void setMaxPollTime (long polling)
| 매개변수 | |
|---|---|
polling |
long |
setPrintSchedulingWarning
public void setPrintSchedulingWarning (boolean print)
| 매개변수 | |
|---|---|
print |
boolean |
shouldShutdownOnCmdfileError
public boolean shouldShutdownOnCmdfileError ()
명령어 오류 시 스케줄러를 종료해야 하는 경우 true를 반환합니다.
| 반환 값 | |
|---|---|
boolean |
|
종료
public void shutdown (boolean notifyStop)
명령어 스케줄러를 단계적으로 종료하려고 시도합니다.
| 매개변수 | |
|---|---|
notifyStop |
boolean: true인 경우 TF 종료 호출을 알립니다. |
shutdownHard
public void shutdownHard (boolean killAdb)
명령어 스케줄러를 강제 종료하려고 시도합니다.
shutdown()와 유사하지만 진행 중인 호출이 더 빨리 완료되도록 '유도'하기 위해 선택적으로 adb 연결을 종료하기도 합니다.
| 매개변수 | |
|---|---|
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 |
stopScheduling
public void stopScheduling ()
새 테스트의 예약 및 수락을 중지하지만 Tradefed는 중지하지 않습니다. 이는 먼저 실행 중인 모든 테스트를 드레인한 다음 Tradefed 프로세스를 종료하는 2단계 종료를 지원하기 위한 것입니다.
보호된 메서드
cleanUp
protected void cleanUp ()
종료하기 전에 로그를 닫고 필요한 다른 정리 작업을 실행합니다.
단위 테스트에서 모의할 수 있도록 노출됩니다.
createConfiguration
protected IConfiguration createConfiguration (String[] args)
| 매개변수 | |
|---|---|
args |
String |
| 반환 값 | |
|---|---|
IConfiguration |
|
| 생성 값 | |
|---|---|
ConfigurationException |
|
createInvocationContext
protected IInvocationContext createInvocationContext ()
| 반환 값 | |
|---|---|
IInvocationContext |
|
dryRunCommandReporting
protected void dryRunCommandReporting (ICommandScheduler.IScheduledInvocationListener handler, IConfiguration config)
지정된 명령어가 테스트 실행인지 확인합니다. 명령어가 테스트 실행인 경우 유효성을 검사합니다. 구성 문제가 있으면 ConfigurationException이 발생합니다.
| 매개변수 | |
|---|---|
handler |
ICommandScheduler.IScheduledInvocationListener: 테스트 실행 유효성 검사를 위해 이벤트를 보고하는 ERROR(/InvocationEventHandler) |
config |
IConfiguration |
| 반환 값 | |
|---|---|
void |
명령어가 시험 실행인 경우 true, 그렇지 않은 경우 false입니다. |
| 생성 값 | |
|---|---|
|
com.android.tradefed.config.ConfigurationException |
ConfigurationException |
|
execCommand
protected long execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener,reservedDevices, String[] args)
| 매개변수 | |
|---|---|
context |
IInvocationContext |
listener |
ICommandScheduler.IScheduledInvocationListener |
reservedDevices |
|
args |
String |
| 반환 값 | |
|---|---|
long |
|
| 생성 값 | |
|---|---|
ConfigurationException |
|
getConfigFactory
protected IConfigurationFactory getConfigFactory ()
IConfigurationFactory 참조를 가져오는 팩터리 메서드
| 반환 값 | |
|---|---|
IConfigurationFactory |
사용할 IConfigurationFactory |
getDeviceManagementServer
protected DeviceManagementGrpcServer getDeviceManagementServer ()
| 반환 값 | |
|---|---|
DeviceManagementGrpcServer |
|
getDeviceManager
protected IDeviceManager getDeviceManager ()
IDeviceManager 참조를 가져오는 팩터리 메서드
| 반환 값 | |
|---|---|
IDeviceManager |
사용할 IDeviceManager |
getKeyStoreClient
protected IKeyStoreClient getKeyStoreClient ()
IGlobalConfiguration에 선언된 IKeyStoreFactory를 사용하여 IKeyStoreClient를 가져옵니다. 정의된 항목이 없으면 null을 반환합니다.
| 반환 값 | |
|---|---|
IKeyStoreClient |
IKeyStoreClient |
getTestInvocationManagementServer
protected TestInvocationManagementServer getTestInvocationManagementServer ()
| 반환 값 | |
|---|---|
TestInvocationManagementServer |
|
initLogging
protected void initLogging ()
ddmlib 로그를 초기화합니다.
단위 테스트에서 모의할 수 있도록 노출됩니다.
isShutdown
protected boolean isShutdown ()
| 반환 값 | |
|---|---|
boolean |
|
processReadyCommands
protected void processReadyCommands (IDeviceManager manager)
| 매개변수 | |
|---|---|
manager |
IDeviceManager |