Package edu.rit.pj.cluster
Class JobFrontendMessage
java.lang.Object
edu.rit.pj.cluster.Message
edu.rit.pj.cluster.JobFrontendMessage
- All Implemented Interfaces:
Externalizable
,Serializable
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:
-
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
ConstructorDescriptionConstruct a new job frontend message.JobFrontendMessage
(int theTag) Construct a new job frontend message with the given message tag. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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
Write this job frontend message to the given object output stream.
-
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
Construct a new "cancel job" message.- Parameters:
theJobScheduler
- Job Scheduler that is calling this method.errmsg
- Error message string.- Returns:
- a
JobFrontendMessage
object.
-
renewLease
Construct a new "renew lease" message.- Parameters:
theJobScheduler
- Job Scheduler that is calling this method.- Returns:
- a
JobFrontendMessage
object.
-
backendFinished
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
Construct a new "cancel job" message.- Parameters:
theJobBackend
- Job Backend that is calling this method.errmsg
- Error message string.- Returns:
- a
JobFrontendMessage
object.
-
renewLease
Construct a new "renew lease" message.- Parameters:
theJobBackend
- Job Backend that is calling this method.- Returns:
- a
JobFrontendMessage
object.
-
requestResource
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
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
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
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
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
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
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
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
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
Write this job frontend message to the given object output stream.- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
- Thrown if an I/O error occurred.
-
readExternal
Read this job frontend message from the given object input stream.- Specified by:
readExternal
in interfaceExternalizable
- 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.
-