CommandScheduler
public
class
CommandScheduler
extends Object
implements
ICommandScheduler
java.lang.Object | |
↳ | com.android.tradefed.command.CommandScheduler |
사용 가능한 모든 기기에서 TradeFederation 명령어를 실행하기 위한 스케줄러입니다.
실행 시간의 총 실행 횟수를 기반으로 실행할 명령어의 우선순위를 지정하려고 시도합니다. 예를 들어 실행 빈도가 낮거나 실행 속도가 빠른 명령어는 장기 실행 명령어보다 우선순위가 높습니다.
종료될 때까지 백그라운드에서 계속 실행됩니다.
요약
중첩된 클래스 | |
---|---|
enum |
CommandScheduler.HostState
호스트의 다양한 상태 enum |
공개 생성자 | |
---|---|
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)
모든 현재 명령어에 지정된 모든 |
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를 지정하여 호출에 관한 정보를 반환합니다. |
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 |
await
public void await ()
이전 TF의 전달이 완료될 때까지 기다리는 경우를 비롯하여 스케줄러가 실행되기 시작할 때까지 기다립니다.
checkDelegation
public static TradefedDelegator checkDelegation (String[] args)
명령줄을 기반으로 위임자를 만들어 실행을 위임해야 하는지 확인합니다.
매개변수 | |
---|---|
args |
String |
반환 값 | |
---|---|
TradefedDelegator |
생성 값 | |
---|---|
ConfigurationException |
completeHandover
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)
모든 현재 명령어에 지정된 모든 Option
값이 포함된 명령어의 확장된 xml 파일을 덤프합니다.
매개변수 | |
---|---|
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를 지정하여 호출에 관한 정보를 반환합니다.
매개변수 | |
---|---|
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 |
handoverInitiationComplete
public void handoverInitiationComplete ()
사용 중인 기기 및 명령어의 초기 전달 교환이 완료되었으며 작업 예약을 시작할 수 있다고 명령어 스케줄러에 알립니다.
handoverShutdown
public boolean handoverShutdown (int handoverPort)
shutdown()
를 시작하고 동일한 호스트에서 다른 트레이드페드 프로세스로 전달합니다.
스케줄러는 사용 가능한 기기가 있으면 해당 포트에서 리슨하는 원격 트레이드페드 프로세스에 이를 알립니다.
매개변수 | |
---|---|
handoverPort |
int |
반환 값 | |
---|---|
boolean |
전달 시작이 성공하면 true , 그렇지 않으면 false
|
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 |
shouldShutdownOnCmdfileError
public boolean shouldShutdownOnCmdfileError ()
명령어 오류로 인해 스케줄러를 종료해야 하는 경우 true를 반환합니다.
반환 값 | |
---|---|
boolean |
종료
public void shutdown ()
명령어 스케줄러를 단계적으로 종료하려고 시도합니다.
테스트를 기다리는 명령어를 지우고 진행 중인 모든 호출을 정상적으로 종료하도록 요청합니다.
종료가 호출되면 스케줄러 기본 루프는 진행 중인 모든 호출이 완료될 때까지 기다린 후 완전히 종료됩니다.
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 |
보호된 메서드
cleanUp
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 ()
IGlobalConfiguration
에 선언된 IKeyStoreFactory
를 사용하여 IKeyStoreClient
를 가져오거나 정의된 것이 없는 경우 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 ()
모든 호출 스레드가 완료될 때까지 기다립니다.