r2757 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
Author: chatellier Date: 2009-11-16 13:38:26 +0000 (Mon, 16 Nov 2009) New Revision: 2757 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java Log: Modify independent analyze plan loop to known which simulation is the last one. Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2009-11-13 08:53:26 UTC (rev 2756) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2009-11-16 13:38:26 UTC (rev 2757) @@ -712,7 +712,7 @@ } } catch (Exception eee) { // add manual log - // we are in a thread, IsisFishRuntimeException is displyed + // we are in a thread, IsisFishRuntimeException is displayed // outside a log if (log.isErrorEnabled()) { log.error(_("isisfish.error.evaluate.preplan.script"), eee); @@ -723,8 +723,14 @@ /** * Genere toutes les sous simulations et les places dans la queue. + * + * Cette methode {@code run()} est appelée seulement dans le cas de la + * génération de plans indépendants. + * + * @see SimulationJob#run() pour les plans dépendants */ public void run() { + /* Original code while (hasNext()) { try { SimulationJob subJob = next(); @@ -739,8 +745,48 @@ .getControl().getId()), eee); } } + }*/ + + // New iteration remember always simulation N and N+1 + // needed to know witch simulation is the last one + // get simulation N + SimulationJob subJobN = null; + if (hasNext()) { + subJobN = next(); } + while (subJobN != null) { + + try { + if (log.isInfoEnabled()) { + log.info("Simulation generated: " + subJobN.getId()); + } + + // set item additionnal informations + SimulationItem itemN = subJobN.getItem(); + itemN.setStandaloneSimulation(true); // idependant plan + // - 1 because planContext.getNumber() is set to next simulation to generate + itemN.setSimulationNumber(planContext.getNumber() - 1); + + // job N+1 + // carefull call this next after itemN.setSimulationNumber() + SimulationJob subJobNp1 = next(); + if (subJobNp1 == null) { + // there is no N+1 job, N is the last one + itemN.setLastSimulation(true); + } + + simulationService.submitSubJob(subJobN); + + subJobN = subJobNp1; + } + catch (Exception eee) { + if (log.isErrorEnabled()) { + log.error(_("Can't add simulation: %s", job.getItem() + .getControl().getId()), eee); + } + } + } } /**
participants (1)
-
chatellier@users.labs.libre-entreprise.org