Changeset 3138 for trunk/openmole/core/org.openmole.core.workflow.implementation/src/main/java/org/openmole/core/workflow/implementation/mole/execution/MoleExecution.java
- Timestamp:
- 03/02/10 11:28:24 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/openmole/core/org.openmole.core.workflow.implementation/src/main/java/org/openmole/core/workflow/implementation/mole/execution/MoleExecution.java
r3134 r3138 28 28 import java.util.logging.Level; 29 29 import java.util.logging.Logger; 30 import org.openmole.core.workflow.implementation.execution.jobgroup.JobCategorizer;31 30 32 31 import org.openmole.misc.exception.InternalProcessingError; … … 41 40 import org.openmole.core.workflow.implementation.job.JobBuild; 42 41 import org.openmole.core.workflow.implementation.job.MoleJobId; 42 import org.openmole.core.workflow.implementation.mole.Mole; 43 43 import org.openmole.core.workflow.implementation.tools.LevelComputing; 44 44 import org.openmole.core.workflow.implementation.tools.RegistryWithTicket; 45 45 import org.openmole.core.workflow.model.capsule.IExplorationTaskCapsule; 46 import org.openmole.core.workflow.model. execution.batch.IJobGroupingStrategy;46 import org.openmole.core.workflow.model.job.IMoleJobGroupingStrategy; 47 47 import org.openmole.core.workflow.model.mole.execution.ISubMoleExecution; 48 48 import org.openmole.core.workflow.model.job.IContext; … … 64 64 private static final Logger LOGGER = Logger.getLogger(MoleExecution.class.getName()); 65 65 66 IMole mole;66 Mole mole; 67 67 BlockingQueue<Trio<IJob, IEnvironment<?>, IGenericTaskCapsule<?, ?>>> jobs = new LinkedBlockingQueue<Trio<IJob, IEnvironment<?>, IGenericTaskCapsule<?, ?>>>(); 68 68 Map<IMoleJob, ISubMoleExecution> inProgress = Collections.synchronizedMap(new TreeMap<IMoleJob, ISubMoleExecution>()); … … 72 72 IExecutionContext executionContext; 73 73 74 Map<IGenericTaskCapsule<?, ?>, Duo<IJobGroupingStrategy, IExplorationTaskCapsule>> groupers = new HashMap<IGenericTaskCapsule<?, ?>, Duo<IJobGroupingStrategy, IExplorationTaskCapsule>>();75 74 IRegistryWithTicket<IGenericTaskCapsule, JobCategorizer> categorizers = new RegistryWithTicket<IGenericTaskCapsule, JobCategorizer>(); 76 75 … … 78 77 //transient Semaphore oneJobFinished; 79 78 80 public MoleExecution( IMole mole, IContext rootContext, IExecutionContext executionContext) throws InternalProcessingError, UserBadDataError {79 public MoleExecution(Mole mole, IContext rootContext, IExecutionContext executionContext) throws InternalProcessingError, UserBadDataError { 81 80 this.mole = mole; 82 81 this.localCommunication = new LocalCommunication(); … … 101 100 102 101 @Override 103 public synchronized void submit(IMoleJob job, IGenericTaskCapsule<?, ?> capsule, IExecutionContext execution, ISubMoleExecution subMole) throws UserBadDataError,InternalProcessingError {102 public synchronized void submit(IMoleJob job, IGenericTaskCapsule<?, ?> capsule, IExecutionContext execution, ISubMoleExecution subMole) throws InternalProcessingError { 104 103 ExecutionInfoRegistry.GetInstance().register(job, this); 105 104 Activator.getEventDispatcher().registerListener(job, getLevel(), new MoleExecutionAdapter(this), MoleJob.stateChanged); … … 119 118 } 120 119 121 private synchronized JobBuild group(IMoleJob job, IGenericTaskCapsule<?, ?> capsule) throws UserBadDataError, InternalProcessingError { 122 if (groupers.containsKey(capsule)) { 123 Duo<IJobGroupingStrategy, IExplorationTaskCapsule> strategy = groupers.get(capsule); 120 private synchronized JobBuild group(IMoleJob job, IGenericTaskCapsule<?, ?> capsule) throws InternalProcessingError { 121 Duo<IMoleJobGroupingStrategy, IExplorationTaskCapsule> strategy = mole.getMoleJobGroupingStrategy(capsule); 122 123 if (strategy != null) { 124 124 125 LevelComputing levelComputing = LevelComputing.getLevelComputing(this); 125 126 … … 127 128 Integer levelOfCapsule = levelComputing.getLevel(capsule); 128 129 129 if (levelOfExploration >= levelOfCapsule) { 130 throw new UserBadDataError("Level of the exploration capsule is higher or the same than the one of the capsule, can't group."); 130 if (levelOfExploration != levelOfCapsule - 1) { 131 LOGGER.warning("The exploration capsule is not just under the capsule to group on, can't group."); 132 return new JobBuild(job); 131 133 } 132 134 … … 158 160 return group; 159 161 } else { 160 JobBuild group = new JobBuild(1);161 group.addJob(job);162 return group;163 } 164 } 162 return new JobBuild(job); 163 } 164 } 165 166 165 167 166 168 @Override





