View Javadoc
1   //******************************************************************************
2   //
3   // File:    JobSchedulerRef.java
4   // Package: edu.rit.pj.cluster
5   // Unit:    Interface edu.rit.pj.cluster.JobSchedulerRef
6   //
7   // This Java source file is copyright (C) 2012 by Alan Kaminsky. All rights
8   // reserved. For further information, contact the author, Alan Kaminsky, at
9   // ark@cs.rit.edu.
10  //
11  // This Java source file is part of the Parallel Java Library ("PJ"). PJ is free
12  // software; you can redistribute it and/or modify it under the terms of the GNU
13  // General Public License as published by the Free Software Foundation; either
14  // version 3 of the License, or (at your option) any later version.
15  //
16  // PJ is distributed in the hope that it will be useful, but WITHOUT ANY
17  // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18  // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19  //
20  // Linking this library statically or dynamically with other modules is making a
21  // combined work based on this library. Thus, the terms and conditions of the GNU
22  // General Public License cover the whole combination.
23  //
24  // As a special exception, the copyright holders of this library give you
25  // permission to link this library with independent modules to produce an
26  // executable, regardless of the license terms of these independent modules, and
27  // to copy and distribute the resulting executable under terms of your choice,
28  // provided that you also meet, for each linked independent module, the terms
29  // and conditions of the license of that module. An independent module is a module
30  // which is not derived from or based on this library. If you modify this library,
31  // you may extend this exception to your version of the library, but you are not
32  // obligated to do so. If you do not wish to do so, delete this exception
33  // statement from your version.
34  //
35  // A copy of the GNU General Public License is provided in the file gpl.txt. You
36  // may also obtain a copy of the GNU General Public License on the World Wide
37  // Web at http://www.gnu.org/licenses/gpl.html.
38  //
39  //******************************************************************************
40  package edu.rit.pj.cluster;
41  
42  import java.io.IOException;
43  
44  /**
45   * Interface JobSchedulerRef specifies the interface for the PJ Job Scheduler
46   * Daemon process.
47   *
48   * @author Alan Kaminsky
49   * @version 24-Jan-2012
50   */
51  public interface JobSchedulerRef {
52  
53  // Exported operations.
54      /**
55       * Report that a backend node failed.
56       *
57       * @param theJobFrontend Job frontend that is calling this method.
58       * @param name Backend node name.
59       * @exception IOException Thrown if an I/O error occurred.
60       * @throws java.io.IOException if any.
61       */
62      public void backendFailed(JobFrontendRef theJobFrontend,
63              String name)
64              throws IOException;
65  
66      /**
67       * Cancel a job.
68       *
69       * @param theJobFrontend Job frontend that is calling this method.
70       * @param errmsg Error message string.
71       * @exception IOException Thrown if an I/O error occurred.
72       * @throws java.io.IOException if any.
73       */
74      public void cancelJob(JobFrontendRef theJobFrontend,
75              String errmsg)
76              throws IOException;
77  
78      /**
79       * Report that a job finished.
80       *
81       * @param theJobFrontend Job frontend that is calling this method.
82       * @exception IOException Thrown if an I/O error occurred.
83       * @throws java.io.IOException if any.
84       */
85      public void jobFinished(JobFrontendRef theJobFrontend)
86              throws IOException;
87  
88      /**
89       * Renew the lease on a job.
90       *
91       * @param theJobFrontend Job frontend that is calling this method.
92       * @exception IOException Thrown if an I/O error occurred.
93       * @throws java.io.IOException if any.
94       */
95      public void renewLease(JobFrontendRef theJobFrontend)
96              throws IOException;
97  
98      /**
99       * Report a comment for a process.
100      *
101      * @param theJobFrontend Job frontend that is calling this method.
102      * @param rank Process rank.
103      * @param comment Comment string.
104      * @exception IOException Thrown if an I/O error occurred.
105      * @throws java.io.IOException if any.
106      */
107     public void reportComment(JobFrontendRef theJobFrontend,
108             int rank,
109             String comment)
110             throws IOException;
111 
112     /**
113      * Request that a job be scheduled.
114      *
115      * @param theJobFrontend Job frontend that is calling this method.
116      * @param username User name.
117      * @param Nn Number of backend nodes.
118      * @param Np Number of processes.
119      * @param Nt Number of CPUs per process. 0 means "all CPUs."
120      * @exception IOException Thrown if an I/O error occurred.
121      * @throws java.io.IOException if any.
122      */
123     public void requestJob(JobFrontendRef theJobFrontend,
124             String username,
125             int Nn,
126             int Np,
127             int Nt)
128             throws IOException;
129 
130     /**
131      * Close communication with this Job Scheduler.
132      */
133     public void close();
134 
135 }