Skip to content

Commit fd56f0d

Browse files
committed
number of concurrent runs management
1 parent e2a072c commit fd56f0d

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

vcell-client/src/main/java/cbit/vcell/solver/ode/gui/LangevinOptionsPanel.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,29 +125,35 @@ public void focusLost(java.awt.event.FocusEvent e) {
125125
int totalNumberOfJobs;
126126
try {
127127
totalNumberOfJobs = Integer.parseInt(getTotalNumberOfJobsJTextField().getText());
128-
if(totalNumberOfJobs < 2) {
129-
totalNumberOfJobs = LangevinSimulationOptions.DefaultTotalNumberOfJobs;
130-
}
131128
} catch(NumberFormatException ex) {
132129
totalNumberOfJobs = solverTaskDescription.getLangevinSimulationOptions().getTotalNumberOfJobs();
133-
if(totalNumberOfJobs < 2) {
134-
totalNumberOfJobs = LangevinSimulationOptions.DefaultTotalNumberOfJobs;
135-
}
130+
}
131+
if(totalNumberOfJobs < 2) {
132+
totalNumberOfJobs = LangevinSimulationOptions.DefaultTotalNumberOfJobs;
133+
}
134+
if(totalNumberOfJobs < solverTaskDescription.getLangevinSimulationOptions().getNumberOfConcurrentJobs()) {
135+
totalNumberOfJobs = solverTaskDescription.getLangevinSimulationOptions().getNumberOfConcurrentJobs();
136+
}
137+
if(totalNumberOfJobs > LangevinSimulationOptions.MaxTotalNumberOfJobs) {
138+
totalNumberOfJobs = LangevinSimulationOptions.MaxTotalNumberOfJobs;
136139
}
137140
solverTaskDescription.getLangevinSimulationOptions().setTotalNumberOfJobs(totalNumberOfJobs);
138141
getTotalNumberOfJobsJTextField().setText(totalNumberOfJobs+"");
139142
} else if(e.getSource() == getNumberOfConcurrentJobsJTextField()) {
140143
int numberOfConcurrentJobs;
141144
try {
142145
numberOfConcurrentJobs = Integer.parseInt(getNumberOfConcurrentJobsJTextField().getText());
143-
if(numberOfConcurrentJobs < 2) {
144-
numberOfConcurrentJobs = LangevinSimulationOptions.DefaultNumberOfConcurrentJobs;
145-
}
146146
} catch(NumberFormatException ex) {
147147
numberOfConcurrentJobs = solverTaskDescription.getLangevinSimulationOptions().getNumberOfConcurrentJobs();
148-
if(numberOfConcurrentJobs < 2) {
149-
numberOfConcurrentJobs = LangevinSimulationOptions.DefaultNumberOfConcurrentJobs;
150-
}
148+
}
149+
if(numberOfConcurrentJobs < 2) {
150+
numberOfConcurrentJobs = LangevinSimulationOptions.DefaultNumberOfConcurrentJobs;
151+
}
152+
if(numberOfConcurrentJobs > solverTaskDescription.getLangevinSimulationOptions().getTotalNumberOfJobs()) {
153+
numberOfConcurrentJobs = solverTaskDescription.getLangevinSimulationOptions().getTotalNumberOfJobs();
154+
}
155+
if(numberOfConcurrentJobs > LangevinSimulationOptions.MaxNumberOfConcurrentJobs) {
156+
numberOfConcurrentJobs = LangevinSimulationOptions.MaxNumberOfConcurrentJobs;
151157
}
152158
solverTaskDescription.getLangevinSimulationOptions().setNumberOfConcurrentJobs(numberOfConcurrentJobs);
153159
getNumberOfConcurrentJobsJTextField().setText(numberOfConcurrentJobs+"");

vcell-core/src/main/java/cbit/vcell/solver/LangevinSimulationOptions.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
public class LangevinSimulationOptions implements Serializable, Matchable, VetoableChangeListener {
2929

3030
public final static int DefaultNumberOfConcurrentJobs = 20; // used for multiple runs on the cluster
31-
public final static int DefaultTotalNumberOfJobs = 100;
31+
public final static int DefaultTotalNumberOfJobs = 20;
32+
public final static int MaxNumberOfConcurrentJobs = 20;
33+
public final static int MaxTotalNumberOfJobs = 200; // arbitrary limit to prevent excessive use of cluster resources
3234

3335
public final static String Partition_Nx = "Partition Nx: ";
3436
public final static String Partition_Ny = "Partition Ny: ";

0 commit comments

Comments
 (0)