Skip to content

Commit 37731c0

Browse files
committed
Running batch simulations.
Getting the batch simulations results. For a math model.
1 parent dec207b commit 37731c0

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

vcell-client/src/main/java/cbit/vcell/client/ClientSimManager.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,22 +304,20 @@ private static void saveFailure(Hashtable<String, Object>hashTable,Simulation si
304304

305305
public void getBatchSimulationsResults(OutputContext outputContext, Simulation simulation) throws java.beans.PropertyVetoException {
306306

307-
308-
309307
// simulation should be a template simulation
310308
if(simulation.getName().contains(SimulationContext.ReservedBatchExtensionString)) {
311309
throw new RuntimeException("Not a valid name for a batch template Simulation: '" + simulation.getName() + "'.");
312310
}
313311

314312
SimulationOwner simOwner = getSimWorkspace().getSimulationOwner();
315-
if(!(simOwner instanceof SimulationContext)) {
316-
throw new RuntimeException("Template Simulation Owner must be a SimulationContext");
317-
}
318-
SimulationContext simContext = (SimulationContext)simOwner;
319-
BioModel bioModel = simContext.getBioModel();
320-
if(bioModel==null) {
321-
throw new RuntimeException("Cannot add simulation, bioModel not set");
322-
}
313+
// if(!(simOwner instanceof SimulationContext)) {
314+
// throw new RuntimeException("Template Simulation Owner must be a SimulationContext");
315+
// }
316+
// SimulationContext simContext = (SimulationContext)simOwner;
317+
// BioModel bioModel = simContext.getBioModel();
318+
// if(bioModel==null) {
319+
// throw new RuntimeException("Cannot add simulation, bioModel not set");
320+
// }
323321

324322
File batchResultsDir = ResourceUtil.getLocalBatchDir();
325323
// File localSimDir = ResourceUtil.getLocalSimDir(User.tempUser.getName());
@@ -329,7 +327,7 @@ public void getBatchSimulationsResults(OutputContext outputContext, Simulation s
329327
public void run(Hashtable<String, Object> hashTable) throws Exception {
330328

331329
// recover the list of batch simulations that belong to this template
332-
Simulation allSims[] = bioModel.getSimulations();
330+
Simulation allSims[] = simOwner.getSimulations();
333331
LinkedHashMap<String, String> importsMap = new LinkedHashMap<>();
334332
LinkedHashMap <String, Boolean> successMap = new LinkedHashMap<>();
335333
String namePrefix = simulation.getName() + SimulationContext.ReservedBatchExtensionString;

vcell-core/src/main/java/cbit/vcell/resource/ResourceUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,22 +282,28 @@ private static void deleteRecursively(File f) throws IOException {
282282
deleteRecursively(c);
283283
}
284284
}
285+
String fName = f.getName();
286+
if(batchResultsDirName.contentEquals(fName)) {
287+
return; // don't delete the batch results directory
288+
}
285289
if (!f.delete()) {
286290
throw new FileNotFoundException("Failed to delete file: " + f);
287291
}
288292
}
293+
public static final String batchResultsDirName = "batchResults";
289294
public static File getLocalBatchDir()
290295
{
291-
File adir = new File(getVcellHome(), "batchResults");
296+
File adir = new File(getVcellHome(), batchResultsDirName);
292297
if(adir.exists()) {
293298
try {
294299
deleteRecursively(adir); // delete the output directory and all its content recursively
295300
} catch (IOException e) {
296301
System.err.println("Failed to empty " + adir.getName());
297302
}
298303
}
304+
boolean ret = false;
299305
if(!adir.exists()) {
300-
adir.mkdirs();
306+
ret = adir.mkdirs();
301307
}
302308
localBatchDir = adir;
303309
return localBatchDir;

0 commit comments

Comments
 (0)