diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index 74271a6f127..8a7a3df026c 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -552,7 +552,8 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn if (trans.security.decode_id(id) in entries): trans.get_user().stored_workflow_menu_entries.remove(entries[trans.security.decode_id(id)]) # set tags - trans.app.tag_handler.set_tags_from_list(user=trans.user, item=stored_workflow, new_tags_list=workflow_dict.get('tags', [])) + if 'tags' in workflow_dict: + trans.app.tag_handler.set_tags_from_list(user=trans.user, item=stored_workflow, new_tags_list=workflow_dict['tags']) if 'steps' in workflow_dict: try: @@ -565,9 +566,6 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn ) except workflows.MissingToolsException: raise exceptions.MessageException("This workflow contains missing tools. It cannot be saved until they have been removed from the workflow or installed.") - else: - # We only adjusted tags and menu entry - return payload else: message = "Updating workflow requires dictionary containing 'workflow' attribute with new JSON description." raise exceptions.RequestParameterInvalidException(message) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 433f407800e..38b75969b87 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -594,7 +594,7 @@ class InputModule(WorkflowModule): progress.set_outputs_for_input(invocation_step, step_outputs) def recover_mapping(self, invocation_step, progress): - progress.set_outputs_for_input(invocation_step) + progress.set_outputs_for_input(invocation_step, already_persisted=True) class InputDataModule(InputModule): @@ -1305,17 +1305,6 @@ class ToolModule(WorkflowModule): return complete - def recover_mapping(self, invocation_step, progress): - outputs = {} - - for output_dataset_assoc in invocation_step.output_datasets: - outputs[output_dataset_assoc.output_name] = output_dataset_assoc.dataset - - for output_dataset_collection_assoc in invocation_step.output_dataset_collections: - outputs[output_dataset_collection_assoc.output_name] = output_dataset_collection_assoc.dataset_collection - - progress.set_step_outputs(invocation_step, outputs) - def _effective_post_job_actions(self, step): effective_post_job_actions = step.post_job_actions[:] for key, value in self.runtime_post_job_actions.items(): diff --git a/lib/galaxy/workflow/run.py b/lib/galaxy/workflow/run.py index 3336139eab3..ae20dcb943f 100644 --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -405,7 +405,7 @@ class WorkflowProgress(object): else: return step_outputs[output_name] - def set_outputs_for_input(self, invocation_step, outputs=None): + def set_outputs_for_input(self, invocation_step, outputs=None, already_persisted=False): step = invocation_step.workflow_step if outputs is None: @@ -420,7 +420,7 @@ class WorkflowProgress(object): elif step_id in self.inputs_by_step_id: outputs['output'] = self.inputs_by_step_id[step_id] - self.set_step_outputs(invocation_step, outputs) + self.set_step_outputs(invocation_step, outputs, already_persisted=already_persisted) def set_step_outputs(self, invocation_step, outputs, already_persisted=False): step = invocation_step.workflow_step diff --git a/test/api/test_workflows.py b/test/api/test_workflows.py index 7608c3c0de2..a778dcd0f52 100644 --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -343,6 +343,20 @@ class WorkflowsApiTestCase(BaseWorkflowsApiTestCase): # Make sure the positions have been updated. map(tweak_step, updated_workflow_content['steps'].items()) + def test_update_tags(self): + workflow_object = self.workflow_populator.load_workflow(name="test_import") + upload_response = self.__test_upload(workflow=workflow_object) + workflow = upload_response.json() + workflow['tags'] = ['a_tag', 'b_tag'] + update_response = self._update_workflow(workflow['id'], workflow).json() + assert update_response['tags'] == ['a_tag', 'b_tag'] + del workflow['tags'] + update_response = self._update_workflow(workflow['id'], workflow).json() + assert update_response['tags'] == ['a_tag', 'b_tag'] + workflow['tags'] = [] + update_response = self._update_workflow(workflow['id'], workflow).json() + assert update_response['tags'] == [] + def test_update_no_tool_id(self): workflow_object = self.workflow_populator.load_workflow(name="test_import") upload_response = self.__test_upload(workflow=workflow_object)