Skip to content

Commit

Permalink
Fixed progress error in parameter exploration
Browse files Browse the repository at this point in the history
Running a modified pipeline in parameter exploration
failed with the new Progress Bar. It tried to fetch
the name of the non-existing module.

vistrails/core/interpreter/cached.py:
  Added full support for job_monitor attribute

vistrails/gui/pipeline_view.py:
  QPipelineScene:
    Handle non-existing module when fetching module name for progress bar

vistrails/gui/vistrail_controller.py
  executeParameterExploration:
    Rearranged and cleaned up code
    Removed controller as argument to execution
    Added job_monitor as argument to execution
  • Loading branch information
rexissimus committed Aug 27, 2015
1 parent 3cb5b7c commit c7782d3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
3 changes: 3 additions & 0 deletions vistrails/core/interpreter/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def fetch(name, default):
module_executed_hook = fetch('module_executed_hook', [])
stop_on_error = fetch('stop_on_error', True)
parent_exec = fetch('parent_exec', None)
job_monitor = fetch('job_monitor', None)

reg = get_module_registry()

Expand Down Expand Up @@ -665,6 +666,7 @@ def execute(self, pipeline, **kwargs):
actions = fetch('actions', None)
done_summon_hooks = fetch('done_summon_hooks', [])
module_executed_hook = fetch('module_executed_hook', [])
job_monitor = fetch('job_monitor', None)
Executes a pipeline using caching. Caching works by reusing
pipelines directly. This means that there exists one global
Expand Down Expand Up @@ -708,6 +710,7 @@ def fetch(name, default):
module_executed_hook = fetch('module_executed_hook', [])
stop_on_error = fetch('stop_on_error', True)
parent_exec = fetch('parent_exec', None)
job_monitor = fetch('job_monitor', None)

if len(kwargs) > 0:
raise VistrailsInternalError('Wrong parameters passed '
Expand Down
6 changes: 5 additions & 1 deletion vistrails/gui/pipeline_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3244,7 +3244,11 @@ def set_module_computing(self, moduleId):
if p is not None:
self.check_progress_canceled()
pipeline = self.controller.current_pipeline
module = pipeline.get_module_by_id(moduleId)
try:
module = pipeline.get_module_by_id(moduleId)
except KeyError:
# Module does not exist in pipeline
return
p.setLabelText(module.name)
QtGui.QApplication.postEvent(self,
QModuleStatusEvent(moduleId, 4, ''))
Expand Down
38 changes: 17 additions & 21 deletions vistrails/gui/vistrail_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def __init__(self, vistrail=None, locator=None, abstractions=None,
self.quiet = False
self.progress = None
self.create_job = False
self.create_job = False

self.analogy = {}
# if self._auto_save is True, an auto_saving timer will save a temporary
Expand Down Expand Up @@ -1275,25 +1274,23 @@ def executeParameterExploration(self, pe, view=None, extra_info={}, showProgress
mCount.append(0)
else:
mCount.append(len(p.modules)+mCount[len(mCount)-1])
mCount.append(len(p.modules)+mCount[len(mCount)-1])

from vistrails.gui.job_monitor import QJobView
jobView = QJobView.instance()
if jobView.updating_now:
debug.critical("Execution Aborted: Job Monitor is updating. "
"Please wait a few seconds and try again.")
return
jobView.updating_now = True

try:
# Now execute the pipelines
if showProgress:
# reset job view
from vistrails.gui.job_monitor import QJobView
jobView = QJobView.instance()
if jobView.updating_now:
debug.critical("Execution Aborted: Job Monitor is updating. "
"Please wait a few seconds and try again.")
return
jobView.updating_now = True

if showProgress:
totalProgress = sum([len(p.modules) for p in modifiedPipelines])
self.progress = PEProgressDialog(self.vistrail_view, totalProgress)
self.progress.show()


interpreter = get_default_interpreter()

images = {}
Expand All @@ -1317,7 +1314,7 @@ def moduleExecuted(objId):
os.path.join(extra_info['pathDumpCells'], name)
pe_cell_id = (pe_log_id,) + pipelinePositions[pi]
kwargs = {'locator': self.locator,
'controller': self,
'job_monitor': self.jobMonitor,
'current_version': self.current_version,
'reason': 'Parameter Exploration %s %s_%s_%s' % pe_cell_id,
'logger': self.get_logger(),
Expand All @@ -1334,7 +1331,6 @@ def moduleExecuted(objId):
if v.uuid not in vistrail_vars])
kwargs['vistrail_variables'] = lambda x: vars.get(x, None)


# Create job
# check if a job exist for this workflow
job_id = 'Parameter Exploration %s %s %s_%s_%s' % ((self.current_version, pe.id) + pipelinePositions[pi])
Expand All @@ -1360,21 +1356,21 @@ def moduleExecuted(objId):
else:
errors.append(((0,0,0), error))

if 'pathDumpCells' in extra_info:
filename = os.path.join(extra_info['pathDumpCells'],
os.path.splitext(self.name)[0])
assembleThumbnails(images, filename)
from vistrails.gui.vistrails_window import _app
_app.notify('execution_updated')
finally:
if showProgress:
self.progress.setValue(totalProgress)
self.progress.hide()
self.progress.deleteLater()
self.progress = None

jobView.updating_now = False
jobView.updating_now = False

if 'pathDumpCells' in extra_info:
filename = os.path.join(extra_info['pathDumpCells'],
os.path.splitext(self.name)[0])
assembleThumbnails(images, filename)
from vistrails.gui.vistrails_window import _app
_app.notify('execution_updated')
return errors

################################################################################
Expand Down

0 comments on commit c7782d3

Please sign in to comment.