001 /* 002 * LogPanel.java 003 * 004 * Created on May 22, 2003, 12:41 PM 005 * 006 * This file is part of the STAR Scheduler. 007 * Copyright (c) 2002-2006 STAR Collaboration - Brookhaven National Laboratory 008 * 009 * STAR Scheduler is free software; you can redistribute it and/or modify 010 * it under the terms of the GNU General Public License as published by 011 * the Free Software Foundation; either version 2 of the License, or 012 * (at your option) any later version. 013 * 014 * STAR Scheduler is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public License 020 * along with STAR Scheduler; if not, write to the Free Software 021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 022 */ 023 024 package gov.bnl.star.offline.scheduler.config; 025 026 /** 027 * 028 * @author Gabriele Carcassi 029 */ 030 public class LSFDispatcherPanel extends javax.swing.JPanel implements WizardPanel { 031 032 /** Creates new form LogPanel */ 033 public LSFDispatcherPanel() { 034 initComponents(); 035 } 036 037 /** This method is called from within the constructor to 038 * initialize the form. 039 * WARNING: Do NOT modify this code. The content of this method is 040 * always regenerated by the Form Editor. 041 */ 042 private void initComponents() {//GEN-BEGIN:initComponents 043 java.awt.GridBagConstraints gridBagConstraints; 044 045 instructions = new javax.swing.JTextArea(); 046 queueLabel = new javax.swing.JLabel(); 047 queue = new javax.swing.JTextField(); 048 optionsLabel = new javax.swing.JLabel(); 049 options = new javax.swing.JTextField(); 050 scratchLabel = new javax.swing.JLabel(); 051 scratch = new javax.swing.JTextField(); 052 maxBsubAttLabel = new javax.swing.JLabel(); 053 maxBsubAtt = new javax.swing.JTextField(); 054 msBtwnFailLabel = new javax.swing.JLabel(); 055 msBtwnFail = new javax.swing.JTextField(); 056 msBtwnSuccessLabel = new javax.swing.JLabel(); 057 msBtwnSuccess = new javax.swing.JTextField(); 058 bsubLabel = new javax.swing.JLabel(); 059 bsub = new javax.swing.JTextField(); 060 061 setLayout(new java.awt.GridBagLayout()); 062 063 instructions.setEditable(false); 064 instructions.setLineWrap(true); 065 instructions.setText("queueName - the default queue to which the scheduler will dispatch jobs\nbsubOptions - this is a string that will be added to any bsub execution\nscratchDir - scratch directory available to the user. The user must have all permissions, including to create and delete that directory. It should be a directory available on a local node, to speed up performance. The directory should be unique for every job.\nmaxBsubAttempts, msBtwnSuccess, msBtwnFailure - one can set the number of attempts the dispatcher will make before declaring failure. maxBsubAttemps is the maximum number of attempts per each submission; msBtwnSuccess is the amount of time that the dispatcher will wait after a successful submission; msBtwnFailure is the amount of time the dispatcher will wait after a failed submission."); 066 instructions.setWrapStyleWord(true); 067 instructions.setFocusable(false); 068 instructions.setOpaque(false); 069 gridBagConstraints = new java.awt.GridBagConstraints(); 070 gridBagConstraints.gridwidth = 4; 071 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 072 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 073 gridBagConstraints.weightx = 1.0; 074 gridBagConstraints.insets = new java.awt.Insets(5, 5, 15, 5); 075 add(instructions, gridBagConstraints); 076 077 queueLabel.setText("queue"); 078 gridBagConstraints = new java.awt.GridBagConstraints(); 079 gridBagConstraints.gridx = 0; 080 gridBagConstraints.gridy = 1; 081 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 082 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 083 add(queueLabel, gridBagConstraints); 084 085 gridBagConstraints = new java.awt.GridBagConstraints(); 086 gridBagConstraints.gridx = 1; 087 gridBagConstraints.gridy = 1; 088 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 089 gridBagConstraints.weightx = 1.0; 090 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 091 add(queue, gridBagConstraints); 092 093 optionsLabel.setText("bsub option"); 094 gridBagConstraints = new java.awt.GridBagConstraints(); 095 gridBagConstraints.gridx = 2; 096 gridBagConstraints.gridy = 2; 097 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 098 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 099 add(optionsLabel, gridBagConstraints); 100 101 options.addKeyListener(new java.awt.event.KeyAdapter() { 102 public void keyTyped(java.awt.event.KeyEvent evt) { 103 textChange(evt); 104 } 105 }); 106 107 gridBagConstraints = new java.awt.GridBagConstraints(); 108 gridBagConstraints.gridx = 3; 109 gridBagConstraints.gridy = 2; 110 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 111 gridBagConstraints.weightx = 1.0; 112 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); 113 add(options, gridBagConstraints); 114 115 scratchLabel.setText("scratch directory*"); 116 gridBagConstraints = new java.awt.GridBagConstraints(); 117 gridBagConstraints.gridx = 2; 118 gridBagConstraints.gridy = 1; 119 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 120 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 121 add(scratchLabel, gridBagConstraints); 122 123 scratch.addKeyListener(new java.awt.event.KeyAdapter() { 124 public void keyTyped(java.awt.event.KeyEvent evt) { 125 textChange(evt); 126 } 127 }); 128 129 gridBagConstraints = new java.awt.GridBagConstraints(); 130 gridBagConstraints.gridx = 3; 131 gridBagConstraints.gridy = 1; 132 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 133 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 134 add(scratch, gridBagConstraints); 135 136 maxBsubAttLabel.setText("timeout in ms*"); 137 gridBagConstraints = new java.awt.GridBagConstraints(); 138 gridBagConstraints.gridx = 0; 139 gridBagConstraints.gridy = 4; 140 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 141 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 142 add(maxBsubAttLabel, gridBagConstraints); 143 144 maxBsubAtt.addKeyListener(new java.awt.event.KeyAdapter() { 145 public void keyTyped(java.awt.event.KeyEvent evt) { 146 textChange(evt); 147 } 148 }); 149 150 gridBagConstraints = new java.awt.GridBagConstraints(); 151 gridBagConstraints.gridx = 1; 152 gridBagConstraints.gridy = 4; 153 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 154 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 155 gridBagConstraints.weighty = 1.0; 156 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 157 add(maxBsubAtt, gridBagConstraints); 158 159 msBtwnFailLabel.setText("ms after failure*"); 160 gridBagConstraints = new java.awt.GridBagConstraints(); 161 gridBagConstraints.gridx = 2; 162 gridBagConstraints.gridy = 3; 163 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 164 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 165 add(msBtwnFailLabel, gridBagConstraints); 166 167 msBtwnFail.addKeyListener(new java.awt.event.KeyAdapter() { 168 public void keyTyped(java.awt.event.KeyEvent evt) { 169 textChange(evt); 170 } 171 }); 172 173 gridBagConstraints = new java.awt.GridBagConstraints(); 174 gridBagConstraints.gridx = 3; 175 gridBagConstraints.gridy = 3; 176 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 177 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 178 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); 179 add(msBtwnFail, gridBagConstraints); 180 181 msBtwnSuccessLabel.setText("ms after success*"); 182 gridBagConstraints = new java.awt.GridBagConstraints(); 183 gridBagConstraints.gridx = 0; 184 gridBagConstraints.gridy = 3; 185 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 186 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 187 add(msBtwnSuccessLabel, gridBagConstraints); 188 189 msBtwnSuccess.addKeyListener(new java.awt.event.KeyAdapter() { 190 public void keyTyped(java.awt.event.KeyEvent evt) { 191 textChange(evt); 192 } 193 }); 194 195 gridBagConstraints = new java.awt.GridBagConstraints(); 196 gridBagConstraints.gridx = 1; 197 gridBagConstraints.gridy = 3; 198 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 199 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 200 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 201 add(msBtwnSuccess, gridBagConstraints); 202 203 bsubLabel.setText("bsub*"); 204 gridBagConstraints = new java.awt.GridBagConstraints(); 205 gridBagConstraints.gridx = 0; 206 gridBagConstraints.gridy = 2; 207 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 208 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 209 add(bsubLabel, gridBagConstraints); 210 211 bsub.addKeyListener(new java.awt.event.KeyAdapter() { 212 public void keyTyped(java.awt.event.KeyEvent evt) { 213 textChange(evt); 214 } 215 }); 216 217 gridBagConstraints = new java.awt.GridBagConstraints(); 218 gridBagConstraints.gridx = 1; 219 gridBagConstraints.gridy = 2; 220 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 221 gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 0); 222 add(bsub, gridBagConstraints); 223 224 }//GEN-END:initComponents 225 226 private void textChange(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textChange 227 firePropertyChange("ready", oldReady, isReady()); 228 oldReady = isReady(); 229 }//GEN-LAST:event_textChange 230 231 private boolean oldReady; 232 public String getTitle() { 233 return "LSFDispatcher"; 234 } 235 236 public boolean isReady() { 237 try { 238 Integer.parseInt(maxBsubAtt.getText()); 239 Integer.parseInt(msBtwnFail.getText()); 240 Integer.parseInt(msBtwnSuccess.getText()); 241 if ("".equals(scratch.getText())) return false; 242 if ("".equals(bsub.getText())) return false; 243 return true; 244 } catch (Exception e) { 245 return false; 246 } 247 } 248 249 public void addProperties(java.util.Map schedulerProperties) { 250 schedulerProperties.put("ProgramLocation.bsub", bsub.getText()); 251 schedulerProperties.put("LSFDispatcher.maxBsubAttempts", new Integer(maxBsubAtt.getText())); 252 schedulerProperties.put("LSFDispatcher.msBtwnSucces", new Integer(msBtwnSuccess.getText())); 253 schedulerProperties.put("LSFDispatcher.msBtwnFailure", new Integer(msBtwnFail.getText())); 254 schedulerProperties.put("LSFDispatcher.bsubOptions", options.getText()); 255 schedulerProperties.put("LSFDispatcher.scratchDir", scratch.getText()); 256 schedulerProperties.put("LSFDispatcher.queueName", queue.getText()); 257 } 258 259 // Variables declaration - do not modify//GEN-BEGIN:variables 260 private javax.swing.JTextField bsub; 261 private javax.swing.JLabel bsubLabel; 262 private javax.swing.JTextArea instructions; 263 private javax.swing.JTextField maxBsubAtt; 264 private javax.swing.JLabel maxBsubAttLabel; 265 private javax.swing.JTextField msBtwnFail; 266 private javax.swing.JLabel msBtwnFailLabel; 267 private javax.swing.JTextField msBtwnSuccess; 268 private javax.swing.JLabel msBtwnSuccessLabel; 269 private javax.swing.JTextField options; 270 private javax.swing.JLabel optionsLabel; 271 private javax.swing.JTextField queue; 272 private javax.swing.JLabel queueLabel; 273 private javax.swing.JTextField scratch; 274 private javax.swing.JLabel scratchLabel; 275 // End of variables declaration//GEN-END:variables 276 277 }