public interface

ICommandScheduler

com.android.tradefed.command.ICommandScheduler
Known Indirect Subclasses

Class Overview

A scheduler for running TradeFederation commands.

Summary

Public Methods
abstract boolean addCommand(String[] args)
Adds a command to the scheduler.
abstract boolean addCommand(String[] args, long totalExecTime)
An alternate addCommand(String[]) that accepts an initial total execution time for the command.
abstract void await()
Waits for scheduler to start running.
abstract void displayCommandQueue(PrintWriter printWriter)
Output detailed debug info on state of command execution queue.
abstract void displayCommandsInfo(PrintWriter printWriter)
Output a list of current commands.
abstract void displayInvocationsInfo(PrintWriter printWriter)
Displays a list of current invocations.
abstract boolean handoverShutdown(int handoverPort)
Initiates a shutdown() and handover to another tradefed process on this same host.
abstract void join()
Waits for scheduler to complete.
abstract void removeAllCommands()
Remove all commands from scheduler
abstract void shutdown()
Attempt to gracefully shutdown the command scheduler.
abstract void shutdownHard()
Attempt to forcefully shutdown the command scheduler.
abstract void shutdownOnEmpty()
Similar to shutdown(), but will instead wait for all commands to be executed before exiting.
abstract void start()
abstract int startRemoteManager()
Starts a socket to listen to remote commands.
abstract boolean stopInvocation(ITestInvocation invocation)
Stop a running invocation.
abstract void stopRemoteManager()
Cancels the currently running remote manager.

Public Methods

public abstract boolean addCommand (String[] args)

Adds a command to the scheduler.

A command is essentially an instance of a configuration to run and its associated arguments.

If "--help" argument is specified, or the config arguments are invalid, the help text for the config will be outputed to stdout. Otherwise, the config will be added to the queue to run.

Parameters
args the config arguments.
Returns
  • true if command was added successfully

public abstract boolean addCommand (String[] args, long totalExecTime)

An alternate addCommand(String[]) that accepts an initial total execution time for the command.

Useful when transitioning pre-existing commands from another tradefed process

Parameters
args the config arguments.
totalExecTime the accumulated elapsed execution time of the command
Returns
  • true if command was added successfully

public abstract void await ()

Waits for scheduler to start running.

Throws
InterruptedException

public abstract void displayCommandQueue (PrintWriter printWriter)

Output detailed debug info on state of command execution queue.

public abstract void displayCommandsInfo (PrintWriter printWriter)

Output a list of current commands.

Parameters
printWriter the PrintWriter to output to.

public abstract void displayInvocationsInfo (PrintWriter printWriter)

Displays a list of current invocations.

Parameters
printWriter the PrintWriter to output to.

public abstract boolean handoverShutdown (int handoverPort)

Initiates a shutdown() and handover to another tradefed process on this same host.

The scheduler will inform the remote tradefed process listening on that port of freed devices as they become available.

Returns
  • true if handover initiation was successful, false otherwise

public abstract void join ()

Waits for scheduler to complete.

Throws
InterruptedException

public abstract void removeAllCommands ()

Remove all commands from scheduler

public abstract void shutdown ()

Attempt to gracefully shutdown the command scheduler.

Clears commands waiting to be tested, and requests that all invocations in progress shut down gracefully.

After shutdown is called, the scheduler main loop will wait for all invocations in progress to complete before exiting completely.

public abstract void shutdownHard ()

Attempt to forcefully shutdown the command scheduler.

Similar to shutdown(), but will also forcefully kill the adb connection, in an attempt to 'inspire' invocations in progress to complete quicker.

public abstract void shutdownOnEmpty ()

Similar to shutdown(), but will instead wait for all commands to be executed before exiting.

Note that if any commands are in loop mode, the scheduler will never exit.

public abstract void start ()

Start the ICommandScheduler.

Will run until shutdown() is called. see start().

public abstract int startRemoteManager ()

Starts a socket to listen to remote commands.

Used to handle handover communication. @see handoverShutdown(int).

Returns
  • the TCP port of the socket or -1 if it failed to start.

public abstract boolean stopInvocation (ITestInvocation invocation)

Stop a running invocation.

Returns
  • true if the invocation was stopped, false otherwise
Throws
UnsupportedOperationException} if the implementation doesn't support this
UnsupportedOperationException

public abstract void stopRemoteManager ()

Cancels the currently running remote manager.