def execute(self): """ execute() -> None Perform the exploration by collecting a list of actions corresponding to each dimension """ registry = get_module_registry() actions = self.table.collectParameterActions() palette = self.get_palette() # Set the annotation to persist the parameter exploration # TODO: For now, we just replace the existing exploration - Later we should append them. xmlString = "<paramexps>\n" + self.getParameterExploration() + "\n</paramexps>" self.controller.vistrail.set_paramexp(self.controller.current_version, xmlString) self.controller.set_changed(True) if palette.pipeline and actions: explorer = ActionBasedParameterExploration() (pipelines, performedActions) = explorer.explore( palette.pipeline, actions) dim = [max(1, len(a)) for a in actions] if (registry.has_module('edu.utah.sci.vistrails.spreadsheet', 'CellLocation') and registry.has_module('edu.utah.sci.vistrails.spreadsheet', 'SheetReference')): modifiedPipelines = palette.virtual_cell.positionPipelines( 'PE#%d %s' % (QParamExploreView.explorationId, self.controller.name), dim[2], dim[1], dim[0], pipelines, self.controller) else: modifiedPipelines = pipelines mCount = [] for p in modifiedPipelines: if len(mCount)==0: mCount.append(0) else: mCount.append(len(p.modules)+mCount[len(mCount)-1]) # Now execute the pipelines totalProgress = sum([len(p.modules) for p in modifiedPipelines]) progress = QtGui.QProgressDialog('Performing Parameter ' 'Exploration...', '&Cancel', 0, totalProgress) progress.setWindowTitle('Parameter Exploration') progress.setWindowModality(QtCore.Qt.WindowModal) progress.show() QParamExploreView.explorationId += 1 interpreter = get_default_interpreter() for pi in xrange(len(modifiedPipelines)): progress.setValue(mCount[pi]) QtCore.QCoreApplication.processEvents() if progress.wasCanceled(): break def moduleExecuted(objId): if not progress.wasCanceled(): progress.setValue(progress.value()+1) QtCore.QCoreApplication.processEvents() kwargs = {'locator': self.controller.locator, 'current_version': self.controller.current_version, 'view': palette.pipeline_view.scene(), 'module_executed_hook': [moduleExecuted], 'reason': 'Parameter Exploration', 'actions': performedActions[pi], } interpreter.execute(modifiedPipelines[pi], **kwargs) progress.setValue(totalProgress)