mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #10087 from mvdbeek/fix_pja_dataset_new
Fix change_datatype PJA when dataset is not yet in object store
This commit is contained in:
@@ -587,7 +587,7 @@ class Registry:
|
||||
# initialization.
|
||||
if data.has_data():
|
||||
data.set_size()
|
||||
data.init_meta(copy_from=data)
|
||||
data.init_meta(copy_from=data)
|
||||
return data
|
||||
|
||||
def load_datatype_converters(self, toolbox, installed_repository_dict=None, deactivate=False, use_cached=False):
|
||||
|
||||
@@ -2324,6 +2324,10 @@ class Dataset(StorableObject, RepresentById):
|
||||
self.sources = []
|
||||
self.hashes = []
|
||||
|
||||
@property
|
||||
def is_new(self):
|
||||
return self.state == self.states.NEW
|
||||
|
||||
def in_ready_state(self):
|
||||
return self.state in self.ready_states
|
||||
|
||||
@@ -2447,7 +2451,7 @@ class Dataset(StorableObject, RepresentById):
|
||||
|
||||
def has_data(self):
|
||||
"""Detects whether there is any data"""
|
||||
return self.get_size() > 0
|
||||
return not self.is_new and self.get_size() > 0
|
||||
|
||||
def mark_deleted(self):
|
||||
self.deleted = True
|
||||
|
||||
@@ -201,12 +201,43 @@ class BaseWorkflowsApiTestCase(ApiTestCase):
|
||||
assert tool_state_value["__class__"] == "RuntimeValue"
|
||||
|
||||
|
||||
class ChangeDatatypeTestCase(object):
|
||||
|
||||
def test_assign_column_pja(self):
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
self.workflow_populator.run_workflow("""
|
||||
class: GalaxyWorkflow
|
||||
inputs:
|
||||
input1: data
|
||||
steps:
|
||||
first_cat:
|
||||
tool_id: cat
|
||||
in:
|
||||
input1: input1
|
||||
outputs:
|
||||
out_file1:
|
||||
change_datatype: bed
|
||||
set_columns:
|
||||
chromCol: 1
|
||||
endCol: 2
|
||||
startCol: 3
|
||||
""", test_data="""
|
||||
input1:
|
||||
value: 1.bed
|
||||
type: File
|
||||
""", history_id=history_id)
|
||||
details_dataset_new_col = self.dataset_populator.get_history_dataset_details(history_id, hid=2, wait=True, assert_ok=True)
|
||||
assert details_dataset_new_col["history_content_type"] == "dataset", details_dataset_new_col
|
||||
assert details_dataset_new_col['metadata_endCol'] == 2
|
||||
assert details_dataset_new_col['metadata_startCol'] == 3
|
||||
|
||||
|
||||
# Workflow API TODO:
|
||||
# - Allow history_id as param to workflow run action. (hist_id)
|
||||
# - Allow post to workflows/<workflow_id>/run in addition to posting to
|
||||
# /workflows with id in payload.
|
||||
# - Much more testing obviously, always more testing.
|
||||
class WorkflowsApiTestCase(BaseWorkflowsApiTestCase):
|
||||
class WorkflowsApiTestCase(BaseWorkflowsApiTestCase, ChangeDatatypeTestCase):
|
||||
|
||||
def test_show_valid(self):
|
||||
workflow_id = self.workflow_populator.simple_workflow("dummy")
|
||||
@@ -3196,35 +3227,6 @@ input1:
|
||||
assert details1["history_content_type"] == "dataset_collection"
|
||||
assert details1["tags"][0] == "name:foo", details1
|
||||
|
||||
@skip_without_tool("cat")
|
||||
def test_assign_column_pja(self):
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
self._run_jobs("""
|
||||
class: GalaxyWorkflow
|
||||
inputs:
|
||||
input1: data
|
||||
steps:
|
||||
first_cat:
|
||||
tool_id: cat
|
||||
in:
|
||||
input1: input1
|
||||
outputs:
|
||||
out_file1:
|
||||
change_datatype: bed
|
||||
set_columns:
|
||||
chromCol: 1
|
||||
endCol: 2
|
||||
startCol: 3
|
||||
""", test_data="""
|
||||
input1:
|
||||
value: 1.bed
|
||||
type: File
|
||||
""", history_id=history_id)
|
||||
details_dataset_new_col = self.dataset_populator.get_history_dataset_details(history_id, hid=2, wait=True, assert_ok=True)
|
||||
assert details_dataset_new_col["history_content_type"] == "dataset", details_dataset_new_col
|
||||
assert details_dataset_new_col['metadata_endCol'] == 2
|
||||
assert details_dataset_new_col['metadata_startCol'] == 3
|
||||
|
||||
@skip_without_tool("collection_creates_pair")
|
||||
@skip_without_tool("cat")
|
||||
def test_run_remove_tag_on_collection_output(self):
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
from galaxy_test.api.test_workflows import ChangeDatatypeTestCase
|
||||
from galaxy_test.base.populators import (
|
||||
DatasetPopulator,
|
||||
WorkflowPopulator,
|
||||
)
|
||||
from galaxy_test.driver import integration_util
|
||||
|
||||
|
||||
class ChangeDatatypeStoreByIdIntegrationTestCase(integration_util.IntegrationTestCase, ChangeDatatypeTestCase):
|
||||
"""Test changing datatype with object_store_store_by: id."""
|
||||
|
||||
framework_tool_and_types = True
|
||||
|
||||
@classmethod
|
||||
def handle_galaxy_config_kwds(cls, config):
|
||||
config["object_store_store_by"] = "id"
|
||||
config["retry_metadata_internally"] = False
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
|
||||
self.workflow_populator = WorkflowPopulator(self.galaxy_interactor)
|
||||
Reference in New Issue
Block a user