Merge pull request #5413 from mvdbeek/fix_dynamic_collection_output_18_01

Allow map-over when discovering dataset collections
This commit is contained in:
John Chilton
2018-01-30 14:51:12 -05:00
committed by GitHub
5 changed files with 28 additions and 15 deletions
+5 -10
View File
@@ -177,19 +177,14 @@ def tool_output_to_structure(get_sliced_input_collection_type, tool_output, coll
if not tool_output.collection:
tree = leaf
else:
collection_type_descriptions = collections_manager.collection_type_descriptions
# Okay this is ToolCollectionOutputStructure not a Structure - different
# concepts of structure.
if tool_output.dynamic_structure:
# Two cases collection_type_source and collection_type right?
tree = UnitializedTree(collection_type_descriptions.for_type_description("list")) # list is obviously wrong...
structured_like = tool_output.structure.structured_like
if structured_like:
collection_type = get_sliced_input_collection_type(structured_like)
else:
structured_like = tool_output.structure.structured_like
if structured_like:
collection_type = get_sliced_input_collection_type(structured_like)
else:
collection_type = tool_output.structure.collection_type
tree = UnitializedTree(collection_type)
collection_type = tool_output.structure.collection_type
tree = UnitializedTree(collection_type)
return tree
@@ -164,6 +164,9 @@ def collect_dynamic_collections(
else:
collection = has_collection
# We are adding dynamic collections, which may be precreated, but their actually state is still new!
collection.populated_state = collection.populated_states.NEW
try:
collection_builder = collections_service.collection_builder_for(
collection
+16
View File
@@ -787,6 +787,22 @@ class ToolsTestCase(api.ApiTestCase):
assert output1_content.startswith("chr1")
assert output2_content.startswith("chr1")
@skip_without_tool("collection_creates_dynamic_list_of_pairs")
def test_map_over_with_discovered_output_collection_elements(self):
with self.dataset_populator.test_history() as history_id:
hdca_id = self.dataset_collection_populator.create_list_in_history(history_id).json()["id"]
inputs = {
"input": {"batch": True, "values": [{"src": "hdca", "id": hdca_id}]}
}
create = self._run('collection_creates_dynamic_list_of_pairs', history_id, inputs).json()
implicit_collections = create['implicit_collections']
self.assertEquals(len(implicit_collections), 1)
self.assertEquals(implicit_collections[0]['collection_type'], 'list:list:paired')
self.assertEquals(implicit_collections[0]['elements'][0]['object']['element_count'], None)
self.dataset_populator.wait_for_job(create["jobs"][0]["id"], assert_ok=True)
hdca = self._get("histories/%s/contents/dataset_collections/%s" % (history_id, implicit_collections[0]['id'])).json()
self.assertEquals(hdca['elements'][0]['object']['elements'][0]['object']['elements'][0]['element_identifier'], 'forward')
def _bed_list(self, history_id):
bed1_contents = open(self.get_filename("1.bed"), "r").read()
bed2_contents = open(self.get_filename("2.bed"), "r").read()
+3 -5
View File
@@ -1814,11 +1814,9 @@ test_data:
self.assertEqual("chr5\t131424298\t131424460\tCCDS4149.1_cds_0_0_chr5_131424299_f\t0\t+\n", content)
def wait_for_invocation_and_jobs(self, history_id, workflow_id, invocation_id, assert_ok=True):
# Revert after https://github.com/galaxyproject/galaxy/issues/5146 is fixed.
# state = self.workflow_populator.wait_for_invocation(workflow_id, invocation_id)
# if assert_ok:
# assert state == "scheduled", state
self.workflow_populator.wait_for_invocation(workflow_id, invocation_id)
state = self.workflow_populator.wait_for_invocation(workflow_id, invocation_id)
if assert_ok:
assert state == "scheduled", state
time.sleep(.5)
self.dataset_populator.wait_for_history_jobs(history_id, assert_ok=assert_ok)
time.sleep(.5)
@@ -14,6 +14,7 @@
]]></command>
<inputs>
<param name="foo" type="text" label="Dummy Parameter" />
<param name="file" type="data" label="Dummy File Parameter" />
</inputs>
<outputs>
<collection name="list_output" type="list:paired" label="Duplicate List">