명령 스케줄러
public class CommandScheduler
extends Object
implements ICommandScheduler
java.lang.객체 | |
↳ | 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를 지정하는 호출 BU에 대한 정보를 반환합니다. |
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를 지정하여 실행 중인 호출을 중지합니다. |
공개 생성자
공개 방법
추가 명령
public Pair<Boolean, Integer> addCommand (String[] args)
스케줄러에 명령을 추가합니다.
명령은 기본적으로 실행할 구성 및 관련 인수의 인스턴스입니다.
"--help" 인수가 지정되면 구성에 대한 도움말 텍스트가 stdout으로 출력됩니다. 그렇지 않으면 구성이 실행할 대기열에 추가됩니다.
매개변수 | |
---|---|
args | String : 구성 인수. |
보고 | |
---|---|
Pair <Boolean, Integer> | 값 쌍, 첫 번째 값은 명령이 성공적으로 추가된 경우 true 입니다. 두 번째 값은 알려진 명령 추적기 ID(음수가 아닌 값)입니다. 명령이 성공적으로 추가된 경우 명령이 모든 장치에 추가되면 0을 반환하고 그렇지 않으면 -1을 반환합니다. |
던지기 | |
---|---|
ConfigurationException |
추가 명령 파일
public void addCommandFile (String cmdFilePath,extraArgs)
주어진 파일의 모든 명령을 스케줄러에 추가합니다.
매개변수 | |
---|---|
cmdFilePath | String : comand 파일의 파일 시스템 경로 |
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 |
보고 | |
---|---|
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,reservedDevices, String[] args)
이미 할당된 장치에 직접 명령을 실행합니다.
매개변수 | |
---|---|
listener | ICommandScheduler.IScheduledInvocationListener : 알릴 ICommandScheduler.IScheduledInvocationListener |
reservedDevices | ERROR(/List ) 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를 지정하는 호출 BU에 대한 정보를 반환합니다.
매개변수 | |
---|---|
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 |
isDeviceInvocationThread
public boolean isDeviceInInvocationThread (ITestDevice device)
활성 호출 스레드에서 장치를 사용하는 경우 true를 반환합니다.
매개변수 | |
---|---|
device | ITestDevice |
보고 | |
---|---|
boolean |
isShuttingDown
public boolean isShuttingDown ()
보고 | |
---|---|
boolean |
파일 변경 알림
public void notifyFileChanged (File cmdFile,extraArgs)
매개변수 | |
---|---|
cmdFile | File |
extraArgs |
removeAllCommands
public void removeAllCommands ()
스케줄러에서 모든 명령 제거
달리다
public void run ()
이 스레드의 기본 실행 블록입니다.
setClearcut클라이언트
public void setClearcutClient (ClearcutClient client)
하네스 데이터를 보고하도록 클라이언트 설정
매개변수 | |
---|---|
client | ClearcutClient |
shouldShutdownOnCmdfileError
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)와 동일합니다.
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 |
보호된 메서드
대청소
protected void cleanUp ()
종료하기 전에 로그를 닫고 기타 필요한 정리 작업을 수행합니다.
단위 테스트가 조롱할 수 있도록 노출되었습니다.
생성 구성
protected IConfiguration createConfiguration (String[] args)
매개변수 | |
---|---|
args | String |
보고 | |
---|---|
IConfiguration |
던지기 | |
---|---|
ConfigurationException |
createInvocationContext
protected IInvocationContext createInvocationContext ()
보고 | |
---|---|
IInvocationContext |
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
에 선언된 IKeyStoreClient
IKeyStoreFactory
가져오거나 정의되지 않은 경우 null을 가져옵니다.
보고 | |
---|---|
IKeyStoreClient | IKeyStoreClient |
getTestInvocationManagementServer
protected TestInvocationManagementServer getTestInvocationManagementServer ()
보고 | |
---|---|
TestInvocationManagementServer |
초기화 로깅
protected void initLogging ()
ddmlib 로그를 초기화합니다.
단위 테스트가 조롱할 수 있도록 노출되었습니다.
isShutdown
protected boolean isShutdown ()
보고 | |
---|---|
boolean |
processReadyCommands
protected void processReadyCommands (IDeviceManager manager)
매개변수 | |
---|---|
manager | IDeviceManager |