From c779e125b7a14918b50a329e3aa4b4ea0bfbfaab Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 9 Oct 2018 10:07:23 -0400 Subject: [PATCH] Allow uploading unparsed YAML when importing format 2 workflows. Avoid re-arranging dictionaries when JSON is being handled for instance. --- lib/galaxy/managers/workflows.py | 2 +- test/base/populators.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index 65831f50f50..5a33c24825a 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -251,7 +251,7 @@ class WorkflowContentsManager(UsesAnnotations): so workflows can be extracted. """ workflow_class = as_dict.get("class", None) - if workflow_class == "GalaxyWorkflow" or "$graph" in as_dict: + if workflow_class == "GalaxyWorkflow" or "$graph" in as_dict or "yaml_content" in as_dict: if not self.app.config.enable_beta_workflow_format: raise exceptions.ConfigDoesNotAllowException("Format2 workflows not enabled.") diff --git a/test/base/populators.py b/test/base/populators.py index deda3c35dab..d2ece68516e 100644 --- a/test/base/populators.py +++ b/test/base/populators.py @@ -554,6 +554,7 @@ class BaseWorkflowPopulator(object): workflow_id = workflow["id"] if round_trip_conversion: workflow_yaml_wrapped = self.download_workflow(workflow_id, style="format2_wrapped_yaml") + assert "yaml_content" in workflow_yaml_wrapped, workflow_yaml_wrapped round_trip_converted_content = workflow_yaml_wrapped["yaml_content"] workflow_id = self.upload_yaml_workflow(round_trip_converted_content, client_convert=False, round_trip_conversion=False) @@ -595,7 +596,7 @@ class BaseWorkflowPopulator(object): api_asserts.assert_status_code_is(response, 200) return response.json() - def run_workflow(self, has_workflow, test_data=None, history_id=None, wait=True, source_type=None, jobs_descriptions=None, expected_response=200, assert_ok=True, client_convert=None, round_trip_format_conversion=False): + def run_workflow(self, has_workflow, test_data=None, history_id=None, wait=True, source_type=None, jobs_descriptions=None, expected_response=200, assert_ok=True, client_convert=None, round_trip_format_conversion=False, raw_yaml=False): """High-level wrapper around workflow API, etc. to invoke format 2 workflows.""" workflow_populator = self @@ -608,7 +609,7 @@ class BaseWorkflowPopulator(object): if client_convert is None: client_convert = not round_trip_format_conversion - workflow_id = workflow_populator.upload_yaml_workflow(has_workflow, source_type=source_type, client_convert=client_convert, round_trip_format_conversion=round_trip_format_conversion) + workflow_id = workflow_populator.upload_yaml_workflow(has_workflow, source_type=source_type, client_convert=client_convert, round_trip_format_conversion=round_trip_format_conversion, raw_yaml=raw_yaml) if test_data is None: if jobs_descriptions is None: