Class JobFrontendMessage

java.lang.Object
edu.rit.pj.cluster.Message
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.
Version:
20-Jun-2012
Author:
Alan Kaminsky
See Also:
  • Constructor Details

    • 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 Details

    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • renewLease

      public static JobFrontendMessage renewLease(JobSchedulerRef theJobScheduler)
      Construct a new "renew lease" message.
      Parameters:
      theJobScheduler - Job Scheduler that is calling this method.
      Returns:
      a JobFrontendMessage object.
    • backendFinished

      public static JobFrontendMessage backendFinished(JobBackendRef theJobBackend)
      Construct a new "backend finished" message.
      Parameters:
      theJobBackend - Job Backend that is calling this method.
      Returns:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • renewLease

      public static JobFrontendMessage renewLease(JobBackendRef theJobBackend)
      Construct a new "renew lease" message.
      Parameters:
      theJobBackend - Job Backend that is calling this method.
      Returns:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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:
      a JobFrontendMessage object.
    • 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.
      IOException - if any.
    • 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.
      IOException - if any.
    • 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
      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
      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.