|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.sun.grid.jgrid.proxy.ComputeServer
This class is the central contact point for clients wishing to run jobs on the grid. It offers the ability to run jobs synchonously and asynchronously and to check on the results of jobs.
Nested Class Summary | |
private static class |
ComputeServer.Lock
This class is used by ComputeServer to wait for jobs to complete. |
Field Summary | |
private static int |
channel_port
The port for the return data channel RMI registry |
private static boolean |
debug
Whether debug information should be printed |
private static java.lang.String |
jobPath
The path to the serialized job files |
private static java.util.Map |
lockbox
A place to store Lock objects referenced by job id. |
private static java.util.logging.Logger |
log
The logging mechanism |
static java.lang.String |
LOOKUP_NAME
The name under which the ComputeServer registers in the RMI registry |
private static long |
nextProcessId
The next job id to be assigned |
private static int |
server_port
The port on which to start the fake server |
private static java.lang.String |
skeletonCommand
The command for the grid engine execution engine to run on the execution host |
private static java.lang.String |
submitCommand
The command used to submit job to the grid engine queue |
private static java.lang.String |
USAGE
The usage information String |
Fields inherited from class java.rmi.server.UnicastRemoteObject |
|
Fields inherited from class java.rmi.server.RemoteServer |
|
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary | |
ComputeServer()
Creates a new instance of ComputeServer |
Method Summary | |
java.io.Serializable |
compute(Computable computable)
This method should never be called. |
java.io.Serializable |
compute(Computable computable,
java.lang.String codebase)
This method submits a job for synchrnous execution. |
java.lang.String |
computeAsynch(Computable job)
This method should never be called. |
java.lang.String |
computeAsynch(Computable computable,
java.lang.String codebase)
This method submits a job for asynchronous execution. |
private static java.lang.String[] |
createCommandStringArray(java.lang.String[] parts)
Creates a command string array from the given arguments |
private void |
deleteJob(java.lang.String id)
This method removes a job from the lockbox and disk. |
private static void |
flushLogs()
This methods flushes the logs |
private static java.lang.String |
getNextProcessId()
This method returns the next job id |
private static java.lang.Object |
getResult(java.lang.String processId)
This method waits for the job to complete and returns the results |
java.io.Serializable |
getResults(java.lang.String jobId)
This method retrieves the results of a job that was executed asynchronously. |
boolean |
isComplete(java.lang.String jobId)
This method check whether an asynchronous job has finished executing. |
static void |
main(java.lang.String[] args)
The main method creates a registry on 1100 for return channel communications and creates a registry on 1099 to receive RMI calls. |
private static void |
prepareLogging()
This method sets up the Logger object |
private static void |
processArguments(java.lang.String[] args)
This method processes the command line arguments and sets the appropriate variables |
private static void |
setLock(java.lang.String processId)
This method creates a Lock object for the job and stores it in the lockbox |
private java.lang.Object |
submitJob(Job job)
Submits the job to the DRM. |
private void |
writeJobToDisk(Job job,
java.lang.String annotation)
This method serializes the Job object to disk at the location given by jobPath. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String LOOKUP_NAME
private static final java.lang.String USAGE
private static java.util.logging.Logger log
private static java.util.Map lockbox
ResultChannelImpl
,
ComputeServer.Lock
private static long nextProcessId
private static java.lang.String jobPath
private static java.lang.String submitCommand
private static java.lang.String skeletonCommand
private static int server_port
private static int channel_port
private static boolean debug
Constructor Detail |
public ComputeServer() throws java.rmi.RemoteException
java.rmi.RemoteException
- thrown when an RMI error occursMethod Detail |
public static void main(java.lang.String[] args)
args
- the command line argumentsprivate static void processArguments(java.lang.String[] args)
args
- The args array from main()private static void prepareLogging()
private static void flushLogs()
private static java.lang.String getNextProcessId()
private static java.lang.String[] createCommandStringArray(java.lang.String[] parts)
parts
- The arguments to reassemble into a command string array
public java.io.Serializable compute(Computable computable) throws java.rmi.RemoteException
compute
in interface ComputeEngine
computable
- the job to compute
java.rmi.RemoteException
- thrown when this method is calledpublic java.io.Serializable compute(Computable computable, java.lang.String codebase) throws java.rmi.RemoteException, ComputeException
compute
in interface ComputeEngine
computable
- the job to be executedcodebase
- an alternate codebase to use for loading the Computable class
java.rmi.RemoteException
- if an error occurs on the server side
ComputeException
- if an error occurs during job executionpublic java.lang.String computeAsynch(Computable job) throws java.rmi.RemoteException
computeAsynch
in interface ComputeEngine
job
- the job to compute
java.rmi.RemoteException
- thrown when this method is calledpublic java.lang.String computeAsynch(Computable computable, java.lang.String codebase) throws java.rmi.RemoteException, ComputeException
computeAsynch
in interface ComputeEngine
codebase
- an alternate codebase to use for loading the Computable classcomputable
- the job to be executed
java.rmi.RemoteException
- if an error occurs on the server side
ComputeException
- if an error occurs during job executionpublic java.io.Serializable getResults(java.lang.String jobId) throws java.rmi.RemoteException, ComputeException
getResults
in interface ComputeEngine
jobId
- the id of the job
java.rmi.RemoteException
- if an error occurs on the server side
ComputeException
- if an error occurs during job executionpublic boolean isComplete(java.lang.String jobId) throws java.rmi.RemoteException, ComputeException
isComplete
in interface ComputeEngine
jobId
- the id of the job
java.rmi.RemoteException
- if an error occurs on the server side
ComputeException
- if an error occurs during job executionprivate java.lang.Object submitJob(Job job) throws java.io.IOException
job
- the object to be executed
java.io.IOException
- thrown if the job cannot be spooledprivate void writeJobToDisk(Job job, java.lang.String annotation) throws java.io.IOException
job
- the job to be serializedannotation
- the location of the client class files
java.io.IOException
- if an error occurs while writing the job to diskprivate static void setLock(java.lang.String processId)
processId
- the id of the job for which to create a lockprivate static java.lang.Object getResult(java.lang.String processId)
processId
- the job id
private void deleteJob(java.lang.String id) throws java.io.IOException
id
- the id of the job to remove
java.io.IOException
- if an error occurs while removing the job from disk
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |