commit/galaxy-central: dannon: Workflows: Viewing and Downloading of workflows with missing tools now handled gracefully.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/d824b236fe80/ changeset: d824b236fe80 user: dannon date: 2012-09-20 23:10:52 summary: Workflows: Viewing and Downloading of workflows with missing tools now handled gracefully. affected #: 3 files diff -r 501641b6f680b88f5e1ef78e1b8080853d59dea8 -r d824b236fe80ffea89cae979112580935abfa7c4 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -668,14 +668,19 @@ if step.type == 'tool' or step.type is None: # Restore the tool state for the step module = module_factory.from_workflow_step( trans, step ) - #Check if tool was upgraded - step.upgrade_messages = module.check_and_update_state() - # Any connected input needs to have value DummyDataset (these - # are not persisted so we need to do it every time) - module.add_dummy_datasets( connections=step.input_connections ) - # Store state with the step - step.module = module - step.state = module.state + if module: + #Check if tool was upgraded + step.upgrade_messages = module.check_and_update_state() + # Any connected input needs to have value DummyDataset (these + # are not persisted so we need to do it every time) + module.add_dummy_datasets( connections=step.input_connections ) + # Store state with the step + step.module = module + step.state = module.state + else: + step.upgrade_messages = "Unknown Tool ID" + step.module = None + step.state = None # Error dict if step.tool_errors: errors[step.id] = step.tool_errors diff -r 501641b6f680b88f5e1ef78e1b8080853d59dea8 -r d824b236fe80ffea89cae979112580935abfa7c4 lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -214,14 +214,12 @@ raise web.httpexceptions.HTTPNotFound() # Security check raises error if user cannot access workflow. self.security_check( trans, stored_workflow, False, True ) - # Get data for workflow's steps. self.get_stored_workflow_steps( trans, stored_workflow ) # Get annotations. stored_workflow.annotation = self.get_item_annotation_str( trans.sa_session, stored_workflow.user, stored_workflow ) for step in stored_workflow.latest_workflow.steps: step.annotation = self.get_item_annotation_str( trans.sa_session, stored_workflow.user, step ) - # Get rating data. user_item_rating = 0 if trans.get_user(): @@ -1010,6 +1008,10 @@ # Stream workflow to file. stored_dict = self._workflow_to_dict( trans, stored ) + if not stored_dict: + #This workflow has a tool that's missing from the distribution + trans.response.status = 400 + return "Workflow cannot be exported due to missing tools." valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' sname = stored.name sname = ''.join(c in valid_chars and c or '_' for c in sname)[0:150] @@ -1661,6 +1663,8 @@ for step in workflow.steps: # Load from database representation module = module_factory.from_workflow_step( trans, step ) + if not module: + return None # Get user annotation. step_annotation = self.get_item_annotation_obj(trans.sa_session, trans.user, step ) annotation_str = "" diff -r 501641b6f680b88f5e1ef78e1b8080853d59dea8 -r d824b236fe80ffea89cae979112580935abfa7c4 templates/workflow/display.mako --- a/templates/workflow/display.mako +++ b/templates/workflow/display.mako @@ -87,10 +87,14 @@ tool = trans.app.toolbox.get_tool( step.tool_id ) %><div class="toolForm"> + %if tool: <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${tool.name}</div><div class="toolFormBody"> ${do_inputs( tool.inputs, step.state.inputs, "", step )} </div> + %else: + <div class="toolFormTitle">Step ${int(step.order_index)+1}: Unknown Tool with id '${step.tool_id}'</div> + %endif </div> %else: ## TODO: always input dataset? Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket