public final class CmdService extends Object
CmdAgent
,
GenericBenchmark
Modifier and Type | Field and Description |
---|---|
static int |
PARALLEL
Parallel flag in FG mode.
|
static int |
SEQUENTIAL
Sequential flag in FG mode.
|
Modifier and Type | Method and Description |
---|---|
boolean |
copy(String srcmachine,
String destmachine,
String srcfile,
String destfile,
boolean append)
Deprecated.
|
boolean |
copyToStream(String srcmachine,
String srcfile,
OutputStream stream)
Copy a file from one remote machine to a stream on the master.
|
boolean |
delete(String srcmachine,
String srcfile)
Deletes the file from the machine.
|
boolean |
delete(String srcmachine,
String dir,
FileFilter filter)
Deletes the file from the machine based on the filter provided.
|
boolean |
doesFileExist(String hostName,
String fileName)
Checks whether the given remote file exists.
|
void |
downloadServices(String machine,
List<String> pathList)
Downloads files used by deploy images, especially services and tools.
|
CommandHandle |
execute(Command c,
String svcPath)
Executes a command from the master's command agent.
|
CommandHandle[] |
execute(String[] machines,
Command c,
String svcPath)
Executes a command from the remote command agent.
|
<V extends Serializable> |
execute(String[] machines,
RemoteCallable<V> callable,
String svcPath)
Executes a job on remote command agents on a list of systems.
|
CommandHandle |
execute(String machine,
Command c,
String svcPath)
Executes a command from the remote command agent.
|
<V extends Serializable> |
execute(String machine,
RemoteCallable<V> callable,
String svcPath)
Executes a job in a remote command agent.
|
boolean |
get(String srcmachine,
String srcfile,
String destfile)
Gets a remote file to the Faban master.
|
static CmdService |
getHandle()
This method is the only way that an external object
can get a reference to the singleton CmdService.
|
String |
getHostName(String machineName)
Returns the hostname of this machine as known to the machine
itself.
|
HostRoles |
getHostRoles()
Obtains the cached HostType object.
|
String |
getMaster()
Obtains the name of the master machine.
|
String |
getMasterIP()
Returns the ip address of the master.
|
String |
getMasterIP(String agentHost)
Returns the ip address of the master's interface best used for
communicating with the target host.
|
String |
getProperty(String machine,
String propFile,
String propName)
Gets a property from a given file.
|
Registry |
getRegistry()
Obtains the registry.
|
String |
getTmpDir(String machine)
Obtains the temporary dircteroy for the given machine.
|
void |
init()
This method is called after every run to re-initialize the data
structures that need to change from one run to another.
|
boolean |
isDirectory(String hostName,
String fileName)
Checks whether the given remote file exists and is a directory.
|
boolean |
isFile(String hostName,
String fileName)
Checks whether the given remote file exists and is a normal file.
|
CommandHandle |
java(Command c,
String svcPath)
Executes a java command from the master's command agent.
|
CommandHandle[] |
java(String[] machines,
Command c,
String svcPath)
Executes a java command from the remote command agent.
|
CommandHandle |
java(String machine,
Command c,
String svcPath)
Executes a java command from the remote command agent.
|
void |
kill()
Kill all commands currently running and cleanup.
|
boolean |
push(String srcfile,
String destmachine,
String destfile)
Pushes a local file on the Faban master to the remote host.
|
void |
setLogLevel(String name,
Level level)
Set the Log level for Agents.
|
boolean |
setup(String benchName,
ParamRepository par)
This method initializes the CmdAgent RMI server processes
on the specified set of machines.
|
boolean |
startAgent(String[] machines,
Class agentClass,
String identifier)
Start Agent in the specified machines.
|
boolean |
startAgent(String machine,
Class agentClass,
String identifier)
Start the agent on a single machine.
|
boolean |
truncate(String srcmachine,
String srcfile)
Truncates the file from the machine.
|
void |
updatePaths(List<String> pathList)
Updates the paths in the local command agent.
|
String[] |
which(String[] machines,
String cmd,
String svcPath)
Returns the location of this command on the target systems.
|
String |
which(String cmd,
String svcPath)
Returns the location of this command on the master system.
|
String |
which(String machine,
String cmd,
String svcPath)
Returns the location of this command on the target system.
|
public static final int SEQUENTIAL
public static final int PARALLEL
public static CmdService getHandle()
public String getMaster()
public String getMasterIP()
public String getMasterIP(String agentHost)
agentHost
- The target hostpublic void init()
public boolean setup(String benchName, ParamRepository par)
benchName
- The name of the benchmarkpar
- The parameter repositorypublic HostRoles getHostRoles()
public String getHostName(String machineName)
machineName
- The target machine to check the host namepublic void updatePaths(List<String> pathList) throws RemoteException
pathList
- The list of paths to downloadRemoteException
- If there is a communication error to the
remote agentpublic void downloadServices(String machine, List<String> pathList) throws RemoteException
machine
- The host name to initiate the downloadpathList
- The list of paths to downloadRemoteException
- If there is a communication error to the
remote agentpublic String which(String cmd, String svcPath) throws RemoteException
cmd
- The command to search forsvcPath
- The service path, if anyRemoteException
- If there is a communication error to the
remote agentpublic String which(String machine, String cmd, String svcPath) throws RemoteException
machine
- The machine to searchcmd
- The command to search forsvcPath
- The service path, if anyRemoteException
- If there is a communication error to the
remote agentpublic String[] which(String[] machines, String cmd, String svcPath)
machines
- The machines to searchcmd
- The command to search forsvcPath
- The service path, if anypublic CommandHandle execute(Command c, String svcPath) throws IOException, InterruptedException
c
- The command to be executedsvcPath
- IOException
- Error communicating with resulting processInterruptedException
- Thread got interrupted waitingRemoteException
- If there is a communication error to the
remote agentpublic CommandHandle execute(String machine, Command c, String svcPath) throws IOException, InterruptedException
machine
- The target machine to execute the commandc
- The command to be executedsvcPath
- The location of the invoking service, if anyIOException
- Error communicating with resulting processInterruptedException
- Thread got interrupted waitingRemoteException
- If there is a communication error to the
remote agentpublic CommandHandle[] execute(String[] machines, Command c, String svcPath) throws IOException, InterruptedException
machines
- The target machines to execute the commandc
- The command to be executedsvcPath
- The location of the invoking service, if anyIOException
- Error communicating with resulting processInterruptedException
- Thread got interrupted waitingRemoteException
- If there is a communication error to the
remote agentpublic CommandHandle java(Command c, String svcPath) throws IOException, InterruptedException
c
- The command to be executedsvcPath
- The location of the invoking service, if anyIOException
- Error communicating with resulting processInterruptedException
- Thread got interrupted waitingRemoteException
- If there is a communication error to the
remote agentpublic CommandHandle java(String machine, Command c, String svcPath) throws IOException, InterruptedException
machine
- The target machine to execute the commandc
- The command to be executedsvcPath
- The location of the invoking service, if anyIOException
- Error communicating with resulting processInterruptedException
- Thread got interrupted waitingRemoteException
- If there is a communication error to the
remote agentpublic CommandHandle[] java(String[] machines, Command c, String svcPath) throws IOException, InterruptedException
machines
- The target machines to execute the commandc
- The command to be executedsvcPath
- The location of the invoking service, if anyIOException
- Error communicating with resulting processInterruptedException
- Thread got interrupted waitingRemoteException
- If there is a communication error to the
remote agentpublic <V extends Serializable> V execute(String machine, RemoteCallable<V> callable, String svcPath) throws Exception
machine
- The host to execute the commandcallable
- The jobsvcPath
- The location of the invoking service, if anyException
- An error occured executing the remote jobpublic <V extends Serializable> List<V> execute(String[] machines, RemoteCallable<V> callable, String svcPath) throws Exception
machines
- The host names to execute the jobcallable
- The jobsvcPath
- The location of the invoking service, if anyException
- An error occurred executing the jobpublic boolean startAgent(String machine, Class agentClass, String identifier) throws Exception
machine
- on which command should be startedagentClass
- Impl Class of the agent to be startedidentifier
- to identify this agent laterException
- An error occurred starting the commandpublic boolean startAgent(String[] machines, Class agentClass, String identifier) throws Exception
machines
- on which command should be startedagentClass
- Impl Class of the agent to be startedidentifier
- to identify this agent laterException
- An error occurred starting the commandspublic String getProperty(String machine, String propFile, String propName) throws IOException
machine
- The machine namepropFile
- The property file namepropName
- The property key nameIOException
- If there is an error accessing the config filepublic void kill()
public boolean push(String srcfile, String destmachine, String destfile)
srcfile
- The source file name, relative to the out dirdestmachine
- The destination machinedestfile
- The destination file namepublic boolean get(String srcmachine, String srcfile, String destfile)
srcmachine
- The source machinesrcfile
- The source file namedestfile
- The destination file name, always full path@Deprecated public boolean copy(String srcmachine, String destmachine, String srcfile, String destfile, boolean append)
srcmachine
- - Name of source machinedestmachine
- - Name of destination machinesrcfile
- - Name of source filedestfile
- - Name of destination fileappend
- to dest file or overwrite itpublic String getTmpDir(String machine)
machine
- The machine namepublic boolean delete(String srcmachine, String srcfile)
srcmachine
- The machine namesrcfile
- The file namepublic boolean delete(String srcmachine, String dir, FileFilter filter)
srcmachine
- The machine namedir
- The directory namefilter
- The file filter to usepublic boolean truncate(String srcmachine, String srcfile)
srcmachine
- The machine namesrcfile
- The file namepublic boolean copyToStream(String srcmachine, String srcfile, OutputStream stream)
srcmachine
- - Name of source machinesrcfile
- - Name of source filestream
- The stream to copy the content topublic void setLogLevel(String name, Level level)
name
- Logger namelevel
- Log levelpublic Registry getRegistry()
public boolean doesFileExist(String hostName, String fileName)
hostName
- The host name to check.fileName
- The file name to test.public boolean isFile(String hostName, String fileName)
hostName
- The host name to check.fileName
- The file name to test.