명령스케줄러
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, extraArgs) addCommandFile (String cmdFilePath, extraArgs) 지정된 파일의 모든 명령을 스케줄러에 추가합니다. |
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, reservedDevices, String[] args) execCommand ( ICommandScheduler.IScheduledInvocationListener listener, reservedDevices, String[] args) 이미 할당된 장치에 직접 명령을 실행합니다. |
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, extraArgs) notifyFileChanged (File cmdFile, extraArgs) |
void | removeAllCommands () 스케줄러에서 모든 명령 제거 |
void | run () 이 스레드의 주요 실행 블록입니다. |
void | setClearcutClient (ClearcutClient client) 하네스 데이터를 보고하도록 클라이언트 설정 |
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를 중지하지는 않습니다. |
공개 생성자
공개 메소드
add명령
public Pair<Boolean, Integer> addCommand (String[] args)
스케줄러에 명령을 추가합니다.
명령은 기본적으로 실행할 구성 및 관련 인수의 인스턴스입니다.
"--help" 인수가 지정되면 구성에 대한 도움말 텍스트가 stdout으로 출력됩니다. 그렇지 않으면 구성이 실행할 대기열에 추가됩니다.
매개변수 | |
---|---|
args | String : 구성 인수입니다. |
보고 | |
---|---|
Pair <Boolean, Integer> | 값 쌍, 첫 번째 값은 명령이 성공적으로 추가된 경우 부울 true 입니다. 두 번째 값은 알려진 명령 추적기 ID(음수가 아닌 값)입니다. 명령이 성공적으로 추가된 경우 모든 장치에 대해 명령이 추가되면 0을 반환하고, 그렇지 않으면 -1을 반환합니다. |
던지기 | |
---|---|
ConfigurationException |
addCommand파일
public void addCommandFile (String cmdFilePath,extraArgs)
지정된 파일의 모든 명령을 스케줄러에 추가합니다.
매개변수 | |
---|---|
cmdFilePath | String : 명령 파일의 파일 시스템 경로 |
extraArgs | String 인수의 ERROR(/List) . 비어 있을 수 있지만 null이 아니어야 합니다. |
던지기 | |
---|---|
ConfigurationException |
기다리다
public void await ()
해당되는 경우 이전 TF에서 핸드오버가 완료될 때까지 기다리는 것을 포함하여 스케줄러가 실행되기 시작할 때까지 기다립니다.
위임 확인
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 |
보고 | |
---|---|
디스플레이CommandQueue
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) 입니다. |
dumpCommandsXml
public void dumpCommandsXml (PrintWriter printWriter, String regex)
모든 현재 명령에 대해 지정된 모든 Option
값을 사용하여 명령에 대한 확장된 xml 파일을 덤프합니다.
매개변수 | |
---|---|
printWriter | PrintWriter : 상태를 출력할 ERROR(/PrintWriter) . |
regex | String : xml 파일을 덤프하기 위해 명령이 일치해야 하는 정규식입니다. null이면 모든 명령이 덤프됩니다. |
exec명령
public long execCommand (ICommandScheduler.IScheduledInvocationListener listener,reservedDevices, String[] args)
이미 할당된 장치에 직접 명령을 실행합니다.
매개변수 | |
---|---|
listener | ICommandScheduler.IScheduledInvocationListener : 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
reservedDevices | ERROR(/List ) ERROR(/List ) 사용 |
args | String : 명령 인수 |
보고 | |
---|---|
long | 예약된 명령의 호출 ID입니다. |
던지기 | |
---|---|
ConfigurationException |
exec명령
public long execCommand (IInvocationContext context, ICommandScheduler.IScheduledInvocationListener listener, String[] args)
이미 존재하는 IInvocationContext
를 사용하여 장치를 명령 대기열에 추가하지 않고 장치를 직접 할당하고 명령을 실행합니다.
매개변수 | |
---|---|
context | IInvocationContext : 기존 IInvocationContext . |
listener | ICommandScheduler.IScheduledInvocationListener : 알림을 받을 ICommandScheduler.IScheduledInvocationListener |
args | String : 명령 인수 |
보고 | |
---|---|
long |
던지기 | |
---|---|
ConfigurationException | |
NoDeviceException |
exec명령
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 |
종료 중
public boolean isShuttingDown ()
보고 | |
---|---|
boolean |
알림파일변경됨
public void notifyFileChanged (File cmdFile,extraArgs)
매개변수 | |
---|---|
cmdFile | File |
extraArgs |
제거모든 명령
public void removeAllCommands ()
스케줄러에서 모든 명령 제거
달리다
public void run ()
이 스레드의 주요 실행 블록입니다.
setClearcutClient
public void setClearcutClient (ClearcutClient client)
하네스 데이터를 보고하도록 클라이언트 설정
매개변수 | |
---|---|
client | ClearcutClient |
ShutdownOnCmdfileError가 발생해야 합니다.
public boolean shouldShutdownOnCmdfileError ()
명령 오류로 인해 스케줄러를 종료해야 하는 경우 true를 반환합니다.
보고 | |
---|---|
boolean |
일시 휴업
public void shutdown (boolean notifyStop)
명령 스케줄러를 정상적으로 종료해 보십시오.
매개변수 | |
---|---|
notifyStop | boolean : true인 경우 TF 종료 호출을 알립니다. |
종료하드
public void shutdownHard (boolean killAdb)
명령 스케줄러를 강제로 종료해 보십시오.
shutdown()
과 비슷하지만, 더 빠르게 완료하기 위해 진행 중인 호출을 '고취'하기 위해 선택적으로 adb 연결을 종료합니다.
매개변수 | |
---|---|
killAdb | boolean |
종료하드
public void shutdownHard ()
명령 스케줄러를 강제로 종료해 보십시오. shutdownHard(true)와 동일합니다.
종료시 비어 있음
public void shutdownOnEmpty ()
shutdown()
과 비슷하지만, 대신 종료하기 전에 모든 명령이 실행될 때까지 기다립니다.
중지 호출
public boolean stopInvocation (ITestInvocation invocation)
실행 중인 호출을 중지합니다.
매개변수 | |
---|---|
invocation | ITestInvocation |
보고 | |
---|---|
boolean | 호출이 중지되었으면 true, 그렇지 않으면 false |
중지 호출
public boolean stopInvocation (int invocationId, String cause)
ID를 지정하여 실행 중인 호출을 중지합니다.
매개변수 | |
---|---|
invocationId | int : 호출의 추적 ID입니다. |
cause | String : 호출을 중지하는 원인입니다. |
보고 | |
---|---|
boolean | 호출이 중지되었으면 true, 그렇지 않으면 false |
stop스케줄링
public void stopScheduling ()
새 테스트 예약 및 수락을 중지하지만 Tradefed를 중지하지는 않습니다. 이는 먼저 실행 중인 모든 테스트를 비운 다음 Tradefed 프로세스를 종료하는 2단계 종료를 활성화하기 위한 것입니다.
보호된 방법
대청소
protected void cleanUp ()
종료하기 전에 로그를 닫고 기타 필요한 정리를 수행합니다.
단위 테스트가 모의할 수 있도록 노출됩니다.
createConfiguration
protected IConfiguration createConfiguration (String[] args)
매개변수 | |
---|---|
args | String |
보고 | |
---|---|
IConfiguration |
던지기 | |
---|---|
ConfigurationException |
createInvocationContext
protected IInvocationContext createInvocationContext ()
보고 | |
---|---|
IInvocationContext |
dryRunCommand보고
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 |
exec명령
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 |
getKeyStore클라이언트
protected IKeyStoreClient getKeyStoreClient ()
IGlobalConfiguration
에 선언된 IKeyStoreClient
를 사용하여 IKeyStoreFactory
가져오거나 정의된 것이 없으면 null을 가져옵니다.
보고 | |
---|---|
IKeyStoreClient | IKeyStore클라이언트 |
getTestInvocationManagementServer
protected TestInvocationManagementServer getTestInvocationManagementServer ()
보고 | |
---|---|
TestInvocationManagementServer |
초기화로깅
protected void initLogging ()
ddmlib 로그를 초기화합니다.
단위 테스트가 모의할 수 있도록 노출됩니다.
종료됨
protected boolean isShutdown ()
보고 | |
---|---|
boolean |
processReady명령
protected void processReadyCommands (IDeviceManager manager)
매개변수 | |
---|---|
manager | IDeviceManager |