Documentation of 'edu.rit.pj.cluster.NonPjJobFrontend' Java class
NonPjJobFrontend
edu.rit.pj.cluster

Class NonPjJobFrontend

  • All Implemented Interfaces:
    JobFrontendRef, java.lang.Runnable


    public class NonPjJobFrontend
    extends java.lang.Object
    implements java.lang.Runnable, JobFrontendRef
    Class NonPjJobFrontend provides the message handler for a job frontend process that communicates with the Job Scheduler to allocate backend nodes but does not run a PJ program.
    • Constructor Summary

      Constructors 
      Constructor and Description
      NonPjJobFrontend(java.lang.String username, int Np)
      Construct a new non-PJ job frontend object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void assignBackend(JobSchedulerRef theJobScheduler, java.lang.String name, java.lang.String host, java.lang.String jvm, java.lang.String classpath, java.lang.String[] jvmflags, int Nt)
      Assign a backend process to the job.
      void assignJobNumber(JobSchedulerRef theJobScheduler, int jobnum, java.lang.String pjhost)
      Assign a job number to the job.
      void backendFinished(JobBackendRef theJobBackend)
      Report that a backend process has finished executing the job.
      void backendReady(JobBackendRef theJobBackend, int rank, java.net.InetSocketAddress middlewareAddress, java.net.InetSocketAddress worldAddress, java.net.InetSocketAddress frontendAddress)
      Report that a backend process is ready to commence executing the job.
      void cancelJob(JobBackendRef theJobBackend, java.lang.String errmsg)
      Cancel the job.
      void cancelJob(JobSchedulerRef theJobScheduler, java.lang.String errmsg)
      Cancel the job.
      void close()
      Close communication with this Job Frontend.
      java.util.List<java.lang.String> getBackendNames()
      Obtain a list of the backend names assigned to this Non-PJ Job Frontend.
      int getJobNumber()
      Obtain the job number assigned to this Non-PJ Job Frontend.
      void inputFileClose(JobBackendRef theJobBackend, int ffd)
      Close the given input file.
      void inputFileOpen(JobBackendRef theJobBackend, int bfd, java.io.File file)
      Open the given input file for reading.
      void inputFileRead(JobBackendRef theJobBackend, int ffd, int len)
      Read bytes from the given input file.
      void inputFileSkip(JobBackendRef theJobBackend, int ffd, long len)
      Skip bytes from the given input file.
      void outputFileClose(JobBackendRef theJobBackend, int ffd)
      Close the given output file.
      void outputFileFlush(JobBackendRef theJobBackend, int ffd)
      Flush accumulated bytes to the given output file.
      void outputFileOpen(JobBackendRef theJobBackend, int bfd, java.io.File file, boolean append)
      Open the given output file for writing or appending.
      void outputFileWrite(JobBackendRef theJobBackend, int ffd, byte[] buf, int off, int len)
      Write the given bytes to the given output file.
      void renewLease(JobBackendRef theJobBackend)
      Renew the lease on the job.
      void renewLease(JobSchedulerRef theJobScheduler)
      Renew the lease on the job.
      void requestResource(JobBackendRef theJobBackend, java.lang.String resourceName)
      Request the given resource from this job frontend's class loader.
      void run()
      Run this Non-PJ Job Frontend.
      void terminateJobFinished(int status)
      Terminate this Non-PJ Job Frontend immediately, sending a "job finished" message to the Job Scheduler.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NonPjJobFrontend

        public NonPjJobFrontend(java.lang.String username,
                                int Np)
                         throws java.io.IOException
        Construct a new non-PJ job frontend object. The job frontend object will contact the Job Scheduler Daemon specified by the "pj.host" and "pj.port" Java system properties. See class PJProperties for further information.

        The non-PJ job frontend object will ask the Job Scheduler Daemon to run one process per node and to use all CPUs on each node. Other possibilities are not supported.

        Parameters:
        username - User name.
        Np - Number of processes (>= 1).
        Throws:
        JobSchedulerException - (subclass of IOException) Thrown if the job frontend object could not contact the Job Scheduler Daemon.
        java.io.IOException - Thrown if an I/O error occurred.
    • Method Detail

      • getJobNumber

        public int getJobNumber()
                         throws java.lang.InterruptedException
        Obtain the job number assigned to this Non-PJ Job Frontend. This method blocks until the requested number of backend processes (a constructor parameter) have been assigned.
        Returns:
        Job number.
        Throws:
        java.lang.InterruptedException - Thrown if the calling thread is interrupted while blocked in this method.
      • getBackendNames

        public java.util.List<java.lang.String> getBackendNames()
                                                         throws java.lang.InterruptedException
        Obtain a list of the backend names assigned to this Non-PJ Job Frontend. This method blocks until the requested number of backend processes (a constructor parameter) have been assigned. The returned list is unmodifiable.
        Returns:
        List of backend names.
        Throws:
        java.lang.InterruptedException - Thrown if the calling thread is interrupted while blocked in this method.
      • run

        public void run()
        Run this Non-PJ Job Frontend.
        Specified by:
        run in interface java.lang.Runnable
      • terminateJobFinished

        public void terminateJobFinished(int status)
        Terminate this Non-PJ Job Frontend immediately, sending a "job finished" message to the Job Scheduler. This method must only be called by a thread other than the thread calling run(). This method calls System.exit(status) to terminate the process.
        Parameters:
        status - Status value for System.exit().
      • assignBackend

        public void assignBackend(JobSchedulerRef theJobScheduler,
                                  java.lang.String name,
                                  java.lang.String host,
                                  java.lang.String jvm,
                                  java.lang.String classpath,
                                  java.lang.String[] jvmflags,
                                  int Nt)
                           throws java.io.IOException
        Assign a backend process to the job.
        Specified by:
        assignBackend in interface JobFrontendRef
        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.
        Nt - Number of CPUs assigned to the process.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • assignJobNumber

        public void assignJobNumber(JobSchedulerRef theJobScheduler,
                                    int jobnum,
                                    java.lang.String pjhost)
                             throws java.io.IOException
        Assign a job number to the job. The host name for the job frontend's middleware channel group is also specified.
        Specified by:
        assignJobNumber in interface JobFrontendRef
        Parameters:
        theJobScheduler - Job Scheduler that is calling this method.
        jobnum - Job number.
        pjhost - Host name for middleware channel group.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • cancelJob

        public void cancelJob(JobSchedulerRef theJobScheduler,
                              java.lang.String errmsg)
                       throws java.io.IOException
        Cancel the job.
        Specified by:
        cancelJob in interface JobFrontendRef
        Parameters:
        theJobScheduler - Job Scheduler that is calling this method.
        errmsg - Error message string.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • renewLease

        public void renewLease(JobSchedulerRef theJobScheduler)
                        throws java.io.IOException
        Renew the lease on the job.
        Specified by:
        renewLease in interface JobFrontendRef
        Parameters:
        theJobScheduler - Job Scheduler that is calling this method.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • backendFinished

        public void backendFinished(JobBackendRef theJobBackend)
                             throws java.io.IOException
        Report that a backend process has finished executing the job.
        Specified by:
        backendFinished in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • backendReady

        public void backendReady(JobBackendRef theJobBackend,
                                 int rank,
                                 java.net.InetSocketAddress middlewareAddress,
                                 java.net.InetSocketAddress worldAddress,
                                 java.net.InetSocketAddress frontendAddress)
                          throws java.io.IOException
        Report that a backend process is ready to commence executing the job.
        Specified by:
        backendReady in interface JobFrontendRef
        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.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • cancelJob

        public void cancelJob(JobBackendRef theJobBackend,
                              java.lang.String errmsg)
                       throws java.io.IOException
        Cancel the job.
        Specified by:
        cancelJob in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        errmsg - Error message string.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • renewLease

        public void renewLease(JobBackendRef theJobBackend)
                        throws java.io.IOException
        Renew the lease on the job.
        Specified by:
        renewLease in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • requestResource

        public void requestResource(JobBackendRef theJobBackend,
                                    java.lang.String resourceName)
                             throws java.io.IOException
        Request the given resource from this job frontend's class loader.
        Specified by:
        requestResource in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        resourceName - Resource name.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • outputFileOpen

        public void outputFileOpen(JobBackendRef theJobBackend,
                                   int bfd,
                                   java.io.File file,
                                   boolean append)
                            throws java.io.IOException
        Open the given output file for writing or appending.
        Specified by:
        outputFileOpen in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        bfd - Backend file descriptor.
        file - File.
        append - True to append, false to overwrite.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • outputFileWrite

        public void outputFileWrite(JobBackendRef theJobBackend,
                                    int ffd,
                                    byte[] buf,
                                    int off,
                                    int len)
                             throws java.io.IOException
        Write the given bytes to the given output file. ffd = 1 refers to the job's standard output stream; ffd = 2 refers to the job's standard error stream; other values refer to a previously opened file.
        Specified by:
        outputFileWrite in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        ffd - Frontend file descriptor.
        buf - Array of bytes to write.
        off - Index of first byte to write.
        len - Number of bytes to write.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • outputFileFlush

        public void outputFileFlush(JobBackendRef theJobBackend,
                                    int ffd)
                             throws java.io.IOException
        Flush accumulated bytes to the given output file.
        Specified by:
        outputFileFlush in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        ffd - Frontend file descriptor.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • outputFileClose

        public void outputFileClose(JobBackendRef theJobBackend,
                                    int ffd)
                             throws java.io.IOException
        Close the given output file.
        Specified by:
        outputFileClose in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        ffd - Frontend file descriptor.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • inputFileOpen

        public void inputFileOpen(JobBackendRef theJobBackend,
                                  int bfd,
                                  java.io.File file)
                           throws java.io.IOException
        Open the given input file for reading.
        Specified by:
        inputFileOpen in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        bfd - Backend file descriptor.
        file - File.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • inputFileRead

        public void inputFileRead(JobBackendRef theJobBackend,
                                  int ffd,
                                  int len)
                           throws java.io.IOException
        Read bytes from the given input file. ffd = 1 refers to the job's standard input stream; other values refer to a previously opened file.
        Specified by:
        inputFileRead in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        ffd - Frontend file descriptor.
        len - Number of bytes to read.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • inputFileSkip

        public void inputFileSkip(JobBackendRef theJobBackend,
                                  int ffd,
                                  long len)
                           throws java.io.IOException
        Skip bytes from the given input file.
        Specified by:
        inputFileSkip in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        ffd - Frontend file descriptor.
        len - Number of bytes to skip.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • inputFileClose

        public void inputFileClose(JobBackendRef theJobBackend,
                                   int ffd)
                            throws java.io.IOException
        Close the given input file.
        Specified by:
        inputFileClose in interface JobFrontendRef
        Parameters:
        theJobBackend - Job Backend that is calling this method.
        ffd - Frontend file descriptor.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • close

        public void close()
        Close communication with this Job Frontend.
        Specified by:
        close in interface JobFrontendRef

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.