|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.pj.cluster.JobBackend
public class JobBackend
Class JobBackend is the main program for a job backend process in the PJ cluster middleware. The job backend process is launched by an SSH remote login from the job frontend process (class JobFrontend).
The command line for the job backend main program is:
java edu.rit.pj.cluster.JobBackend username jobnum K
rank hasFrontendComm frontendHost frontendPort
backendHost
username = User name
jobnum = Job number
K = Number of backend processes (>= 1)
rank = Rank of this backend process (0 .. K-1)
hasFrontendComm = Whether the frontend communicator exists
(true or false)
frontendHost = Job frontend's middleware channel group host name
frontendPort = Job frontend's middleware channel group port number
backendHost = Job backend's middleware channel group host name
| Method Summary | |
|---|---|
void |
cancelJob(JobFrontendRef theJobFrontend,
String errmsg)
Cancel the job. |
void |
close()
Close communication with this Job Backend. |
void |
commenceJob(JobFrontendRef theJobFrontend,
InetSocketAddress[] middlewareAddress,
InetSocketAddress[] worldAddress,
InetSocketAddress[] frontendAddress,
Properties properties,
String mainClassName,
String[] args)
Commence the job. |
String[] |
getArgs()
Obtain this job's command line arguments. |
String |
getBackendHost()
Obtain the backend host name on which this job is running. |
ClassLoader |
getClassLoader()
Obtain this job's backend class loader. |
BackendFileReader |
getFileReader()
Obtain this job's backend file reader. |
BackendFileWriter |
getFileWriter()
Obtain this job's backend file writer. |
InetSocketAddress[] |
getFrontendAddress()
Obtain this job's array of hosts/ports for the frontend communicator. |
ChannelGroup |
getFrontendChannelGroup()
Obtain this job's frontend communicator channel group. |
static JobBackend |
getJobBackend()
Obtain the Job Backend object. |
int |
getJobNumber()
Obtain this job's job number. |
int |
getK()
Obtain the number of backend processes in this job. |
String |
getMainClassName()
Obtain this job's main class name. |
Properties |
getProperties()
Obtain this job's Java system properties. |
int |
getRank()
Obtain the rank of this backend process in this job. |
String |
getUserName()
Obtain this job's user name. |
InetSocketAddress[] |
getWorldAddress()
Obtain this job's array of hosts/ports for the world communicator. |
ChannelGroup |
getWorldChannelGroup()
Obtain this job's world communicator channel group. |
boolean |
hasFrontendCommunicator()
Determine whether the frontend communicator exists in this job. |
void |
inputFileCloseResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
Report the result of closing the given input file. |
void |
inputFileOpenResult(JobFrontendRef theJobFrontend,
int bfd,
int ffd,
IOException exc)
Report the result of opening the given input file. |
void |
inputFileReadResult(JobFrontendRef theJobFrontend,
int ffd,
byte[] buf,
int len,
IOException exc)
Report the result of reading the given input file. |
void |
inputFileSkipResult(JobFrontendRef theJobFrontend,
int ffd,
long len,
IOException exc)
Report the result of skipping the given input file. |
void |
jobFinished(JobFrontendRef theJobFrontend)
Report that the job finished. |
static void |
main(String[] args)
Job Backend main program. |
void |
outputFileCloseResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
Report the result of closing the given output file. |
void |
outputFileFlushResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
Report the result of flushing the given output file. |
void |
outputFileOpenResult(JobFrontendRef theJobFrontend,
int bfd,
int ffd,
IOException exc)
Report the result of opening the given output file. |
void |
outputFileWriteResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
Report the result of writing the given output file. |
void |
renewLease(JobFrontendRef theJobFrontend)
Renew the lease on the job. |
void |
reportResource(JobFrontendRef theJobFrontend,
String resourceName,
byte[] content)
Report the content for a previously-requested resource. |
void |
reportResource(JobFrontendRef theJobFrontend,
String resourceName,
ByteSequence content)
Report the content for a previously-requested resource. |
void |
run()
Run this Job Backend. |
void |
setComment(String comment)
Set the comment string for this job backend process. |
void |
waitForCommence()
Wait until this job commences. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void run()
run in interface Runnable
public void cancelJob(JobFrontendRef theJobFrontend,
String errmsg)
throws IOException
cancelJob in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.errmsg - Error message string.
IOException - Thrown if an I/O error occurred.
public void commenceJob(JobFrontendRef theJobFrontend,
InetSocketAddress[] middlewareAddress,
InetSocketAddress[] worldAddress,
InetSocketAddress[] frontendAddress,
Properties properties,
String mainClassName,
String[] args)
throws IOException
commenceJob in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.middlewareAddress - Array of hosts/ports for middleware messages. The first K
elements are for the job backend processes in rank order, the
K+1st element is for the job frontend process. If theworldAddress - Array of hosts/ports for the world communicator. The K
elements are for the job backend processes in rank order.frontendAddress - Array of hosts/ports for the frontend communicator. The first
K elements are for the job backend processes in rank order,
the K+1st element is for the job frontend process. If the
frontend communicator does not exist, frontendAddress is
null.properties - Java system properties.mainClassName - Fully qualified class name of the Java main program class to execute.args - Array of 0 or more Java command line arguments.
IOException - Thrown if an I/O error occurred.
public void jobFinished(JobFrontendRef theJobFrontend)
throws IOException
jobFinished in interface JobBackendReftheJobFrontend - Job frontend that is calling this method.
IOException - Thrown if an I/O error occurred.
public void renewLease(JobFrontendRef theJobFrontend)
throws IOException
renewLease in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.
IOException - Thrown if an I/O error occurred.
public void reportResource(JobFrontendRef theJobFrontend,
String resourceName,
byte[] content)
throws IOException
reportResource in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.resourceName - Resource name.content - Resource content, or null if resource not found.
IOException - Thrown if an I/O error occurred.
public void reportResource(JobFrontendRef theJobFrontend,
String resourceName,
ByteSequence content)
throws IOException
reportResource in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.resourceName - Resource name.content - Resource content, or null if resource not found.
IOException - Thrown if an I/O error occurred.
public void outputFileOpenResult(JobFrontendRef theJobFrontend,
int bfd,
int ffd,
IOException exc)
throws IOException
outputFileOpenResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.bfd - Backend file descriptor.ffd - Frontend file descriptor if success.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void outputFileWriteResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
throws IOException
outputFileWriteResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.ffd - Frontend file descriptor.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void outputFileFlushResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
throws IOException
outputFileFlushResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.ffd - Frontend file descriptor.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void outputFileCloseResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
throws IOException
outputFileCloseResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.ffd - Frontend file descriptor.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void inputFileOpenResult(JobFrontendRef theJobFrontend,
int bfd,
int ffd,
IOException exc)
throws IOException
inputFileOpenResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.bfd - Backend file descriptor.ffd - Frontend file descriptor if success.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void inputFileReadResult(JobFrontendRef theJobFrontend,
int ffd,
byte[] buf,
int len,
IOException exc)
throws IOException
inputFileReadResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.ffd - Frontend file descriptor.buf - Bytes read.len - Number of bytes read, or -1 if EOF.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void inputFileSkipResult(JobFrontendRef theJobFrontend,
int ffd,
long len,
IOException exc)
throws IOException
inputFileSkipResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.ffd - Frontend file descriptor.len - Number of bytes skipped.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.
public void inputFileCloseResult(JobFrontendRef theJobFrontend,
int ffd,
IOException exc)
throws IOException
inputFileCloseResult in interface JobBackendReftheJobFrontend - Job Frontend that is calling this method.ffd - Frontend file descriptor.exc - Null if success, exception if failure.
IOException - Thrown if an I/O error occurred.public void close()
close in interface JobBackendRefpublic String getUserName()
public int getJobNumber()
public int getK()
public int getRank()
public String getBackendHost()
public boolean hasFrontendCommunicator()
public ClassLoader getClassLoader()
public BackendFileWriter getFileWriter()
public BackendFileReader getFileReader()
public void waitForCommence()
public ChannelGroup getWorldChannelGroup()
public InetSocketAddress[] getWorldAddress()
public ChannelGroup getFrontendChannelGroup()
public InetSocketAddress[] getFrontendAddress()
public Properties getProperties()
public String getMainClassName()
public String[] getArgs()
public void setComment(String comment)
Calling setComment() causes a message to be sent to the job frontend process, which in turn causes a message to be sent to the Job Scheduler. (Any I/O errors during message sending are ignored.) Consequently, don't call setComment() too frequently, or the program's performance will suffer.
comment - Comment string.public static JobBackend getJobBackend()
public static void main(String[] args)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||