edu.rit.pj.cluster
Class JobFrontendMessage

java.lang.Object
  extended by edu.rit.pj.cluster.Message
      extended by edu.rit.pj.cluster.JobFrontendMessage
All Implemented Interfaces:
Externalizable, Serializable

public abstract class JobFrontendMessage
extends Message
implements Externalizable

Class JobFrontendMessage provides a message sent to a Job Frontend process (interface JobFrontendRef) in the PJ cluster middleware.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.rit.pj.cluster.Message
FILE_READ_DATA, FILE_WRITE_DATA, FROM_JOB_BACKEND, FROM_JOB_FRONTEND, FROM_JOB_LAUNCHER, FROM_JOB_SCHEDULER
 
Constructor Summary
JobFrontendMessage()
          Construct a new job frontend message.
JobFrontendMessage(int theTag)
          Construct a new job frontend message with the given message tag.
 
Method Summary
static JobFrontendMessage assignBackend(JobSchedulerRef theJobScheduler, String name, String host, String jvm, String classpath, String[] jvmflags, String shellCommand, int Nt)
          Construct a new "assign backend" message.
static JobFrontendMessage assignJobNumber(JobSchedulerRef theJobScheduler, int jobnum, String pjhost)
          Construct a new "assign job number" message.
static JobFrontendMessage backendFinished(JobBackendRef theJobBackend)
          Construct a new "backend finished" message.
static JobFrontendMessage backendReady(JobBackendRef theJobBackend, int rank, InetSocketAddress middlewareAddress, InetSocketAddress worldAddress, InetSocketAddress frontendAddress)
          Construct a new "backend ready" message.
static JobFrontendMessage cancelJob(JobBackendRef theJobBackend, String errmsg)
          Construct a new "cancel job" message.
static JobFrontendMessage cancelJob(JobSchedulerRef theJobScheduler, String errmsg)
          Construct a new "cancel job" message.
static JobFrontendMessage inputFileClose(JobBackendRef theJobBackend, int ffd)
          Construct a new "input file close" message.
static JobFrontendMessage inputFileOpen(JobBackendRef theJobBackend, int bfd, File file)
          Construct a new "input file open" message.
static JobFrontendMessage inputFileRead(JobBackendRef theJobBackend, int ffd, int len)
          Construct a new "input file read" message.
static JobFrontendMessage inputFileSkip(JobBackendRef theJobBackend, int ffd, long len)
          Construct a new "input file skip" message.
 void invoke(JobFrontendRef theJobFrontend, JobBackendRef theJobBackend)
          Invoke the method corresponding to this job frontend message on the given Job Frontend object.
 void invoke(JobFrontendRef theJobFrontend, JobSchedulerRef theJobScheduler)
          Invoke the method corresponding to this job frontend message on the given Job Frontend object.
static JobFrontendMessage outputFileClose(JobBackendRef theJobBackend, int ffd)
          Construct a new "output file close" message.
static JobFrontendMessage outputFileFlush(JobBackendRef theJobBackend, int ffd)
          Construct a new "output file flush" message.
static JobFrontendMessage outputFileOpen(JobBackendRef theJobBackend, int bfd, File file, boolean append)
          Construct a new "output file open" message.
static JobFrontendMessage outputFileWrite(JobBackendRef theJobBackend, int ffd, int len)
          Construct a new "output file write" message.
 void readExternal(ObjectInput in)
          Read this job frontend message from the given object input stream.
static JobFrontendMessage renewLease(JobBackendRef theJobBackend)
          Construct a new "renew lease" message.
static JobFrontendMessage renewLease(JobSchedulerRef theJobScheduler)
          Construct a new "renew lease" message.
static JobFrontendMessage reportComment(JobBackendRef theJobBackend, int rank, String comment)
          Construct a new "report comment" message.
static JobFrontendMessage requestResource(JobBackendRef theJobBackend, String resourceName)
          Construct a new "request resource" message.
 void writeExternal(ObjectOutput out)
          Write this job frontend message to the given object output stream.
 
Methods inherited from class edu.rit.pj.cluster.Message
getTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobFrontendMessage

public JobFrontendMessage()
Construct a new job frontend message.


JobFrontendMessage

public JobFrontendMessage(int theTag)
Construct a new job frontend message with the given message tag.

Parameters:
theTag - Message tag to use when sending this message.
Method Detail

assignBackend

public static JobFrontendMessage assignBackend(JobSchedulerRef theJobScheduler,
                                               String name,
                                               String host,
                                               String jvm,
                                               String classpath,
                                               String[] jvmflags,
                                               String shellCommand,
                                               int Nt)
Construct a new "assign backend" message.

Parameters:
theJobScheduler - Job Scheduler that is calling this method.
name - Backend node name.
host - Host name for SSH remote login.
jvm - Full pathname of Java Virtual Machine.
classpath - Java class path for PJ Library.
jvmflags - Array of JVM command line flags.
shellCommand - Shell command string.
Nt - Number of CPUs assigned to the process.
Returns:
"Assign backend" message.

assignJobNumber

public static JobFrontendMessage assignJobNumber(JobSchedulerRef theJobScheduler,
                                                 int jobnum,
                                                 String pjhost)
Construct a new "assign job number" message.

Parameters:
theJobScheduler - Job Scheduler that is calling this method.
jobnum - Job number.
pjhost - Host name for middleware channel group.
Returns:
"Assign job number" message.

cancelJob

public static JobFrontendMessage cancelJob(JobSchedulerRef theJobScheduler,
                                           String errmsg)
Construct a new "cancel job" message.

Parameters:
theJobScheduler - Job Scheduler that is calling this method.
errmsg - Error message string.
Returns:
"Cancel job" message.

renewLease

public static JobFrontendMessage renewLease(JobSchedulerRef theJobScheduler)
Construct a new "renew lease" message.

Parameters:
theJobScheduler - Job Scheduler that is calling this method.
Returns:
"Renew lease" message.

backendFinished

public static JobFrontendMessage backendFinished(JobBackendRef theJobBackend)
Construct a new "backend finished" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
Returns:
"Backend finished" message.

backendReady

public static JobFrontendMessage backendReady(JobBackendRef theJobBackend,
                                              int rank,
                                              InetSocketAddress middlewareAddress,
                                              InetSocketAddress worldAddress,
                                              InetSocketAddress frontendAddress)
Construct a new "backend ready" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
rank - Rank of the job backend process.
middlewareAddress - Host/port to which the job backend process is listening for middleware messages.
worldAddress - Host/port to which the job backend process is listening for the world communicator.
frontendAddress - Host/port to which the job backend process is listening for the frontend communicator, or null if the frontend communicator does not exist.
Returns:
"Backend ready" message.

cancelJob

public static JobFrontendMessage cancelJob(JobBackendRef theJobBackend,
                                           String errmsg)
Construct a new "cancel job" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
errmsg - Error message string.
Returns:
"Cancel job" message.

renewLease

public static JobFrontendMessage renewLease(JobBackendRef theJobBackend)
Construct a new "renew lease" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
Returns:
"Renew lease" message.

requestResource

public static JobFrontendMessage requestResource(JobBackendRef theJobBackend,
                                                 String resourceName)
Construct a new "request resource" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
resourceName - Resource name.
Returns:
"Request resource" message.

outputFileOpen

public static JobFrontendMessage outputFileOpen(JobBackendRef theJobBackend,
                                                int bfd,
                                                File file,
                                                boolean append)
Construct a new "output file open" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
bfd - Backend file descriptor.
file - File.
append - True to append, false to overwrite.
Returns:
"Output file open" message.

outputFileWrite

public static JobFrontendMessage outputFileWrite(JobBackendRef theJobBackend,
                                                 int ffd,
                                                 int len)
Construct a new "output file write" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
ffd - Frontend file descriptor.
len - Number of bytes to write.
Returns:
"Output file write" message.

outputFileFlush

public static JobFrontendMessage outputFileFlush(JobBackendRef theJobBackend,
                                                 int ffd)
Construct a new "output file flush" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
ffd - Frontend file descriptor.
Returns:
"Flush file" message.

outputFileClose

public static JobFrontendMessage outputFileClose(JobBackendRef theJobBackend,
                                                 int ffd)
Construct a new "output file close" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
ffd - Frontend file descriptor.
Returns:
"Output file close" message.

inputFileOpen

public static JobFrontendMessage inputFileOpen(JobBackendRef theJobBackend,
                                               int bfd,
                                               File file)
Construct a new "input file open" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
bfd - Backend file descriptor.
file - File.
Returns:
"Input file open" message.

inputFileRead

public static JobFrontendMessage inputFileRead(JobBackendRef theJobBackend,
                                               int ffd,
                                               int len)
Construct a new "input file read" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
ffd - Frontend file descriptor.
len - Number of bytes to read.
Returns:
"Input file read" message.

inputFileSkip

public static JobFrontendMessage inputFileSkip(JobBackendRef theJobBackend,
                                               int ffd,
                                               long len)
Construct a new "input file skip" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
ffd - Frontend file descriptor.
len - Number of bytes to skip.
Returns:
"Input file skip" message.

inputFileClose

public static JobFrontendMessage inputFileClose(JobBackendRef theJobBackend,
                                                int ffd)
Construct a new "input file close" message.

Parameters:
theJobBackend - Job Backend that is calling this method.
ffd - Frontend file descriptor.
Returns:
"Input file close" message.

reportComment

public static JobFrontendMessage reportComment(JobBackendRef theJobBackend,
                                               int rank,
                                               String comment)
Construct a new "report comment" message.

Parameters:
theJobBackend - Job backend that is calling this method.
rank - Process rank.
comment - Comment string.
Returns:
"Report comment" message.

invoke

public void invoke(JobFrontendRef theJobFrontend,
                   JobSchedulerRef theJobScheduler)
            throws IOException
Invoke the method corresponding to this job frontend message on the given Job Frontend object. The method arguments come from the fields of this job frontend message object.

Parameters:
theJobFrontend - Job Frontend on which to invoke the method.
theJobScheduler - Job Scheduler that is calling the method.
Throws:
IOException - Thrown if an I/O error occurred.

invoke

public void invoke(JobFrontendRef theJobFrontend,
                   JobBackendRef theJobBackend)
            throws IOException
Invoke the method corresponding to this job frontend message on the given Job Frontend object. The method arguments come from the fields of this job frontend message object.

Parameters:
theJobFrontend - Job Frontend on which to invoke the method.
theJobBackend - Job Backend that is calling the method.
Throws:
IOException - Thrown if an I/O error occurred.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this job frontend message to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Read this job frontend message from the given object input stream.

Specified by:
readExternal in interface Externalizable
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if a class needed to read this job backend message could not be found.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.