mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix the dataset controller's stderr method and add one for stdout. Link to
both from the dataset info page. The functional tests will now provide output of these on tool test failure. The functional tests can now use tool_dependency_dir as well.
This commit is contained in:
@@ -154,10 +154,24 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesHistory, UsesHist
|
||||
hda = trans.sa_session.query( model.HistoryDatasetAssociation ).get( id )
|
||||
return trans.fill_template( "dataset/errors.mako", hda=hda )
|
||||
@web.expose
|
||||
def stderr( self, trans, id ):
|
||||
dataset = trans.sa_session.query( model.HistoryDatasetAssociation ).get( id )
|
||||
job = dataset.creating_job_associations[0].job
|
||||
def stdout( self, trans, dataset_id=None, **kwargs ):
|
||||
trans.response.set_content_type( 'text/plain' )
|
||||
try:
|
||||
hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) )
|
||||
assert hda and trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset )
|
||||
job = hda.creating_job_associations[0].job
|
||||
except:
|
||||
return "Invalid dataset ID or you are not allowed to access this dataset"
|
||||
return job.stdout
|
||||
@web.expose
|
||||
def stderr( self, trans, dataset_id=None, **kwargs ):
|
||||
trans.response.set_content_type( 'text/plain' )
|
||||
try:
|
||||
hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) )
|
||||
assert hda and trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset )
|
||||
job = hda.creating_job_associations[0].job
|
||||
except:
|
||||
return "Invalid dataset ID or you are not allowed to access this dataset"
|
||||
return job.stderr
|
||||
@web.expose
|
||||
def report_error( self, trans, id, email='', message="" ):
|
||||
|
||||
@@ -58,6 +58,7 @@ def main():
|
||||
tool_path = os.environ.get( 'GALAXY_TEST_TOOL_PATH', 'tools' )
|
||||
tool_config_file = os.environ.get( 'GALAXY_TEST_TOOL_CONF', 'tool_conf.xml.sample' )
|
||||
tool_data_table_config_path = 'tool_data_table_conf.xml'
|
||||
tool_dependency_dir = os.environ.get( 'GALAXY_TOOL_DEPENDENCY_DIR', None )
|
||||
if os.path.exists( 'tool_data_table_conf.test.xml' ):
|
||||
tool_data_table_config_path = 'tool_data_table_conf.test.xml'
|
||||
if start_server:
|
||||
@@ -149,6 +150,9 @@ def main():
|
||||
if not database_connection.startswith( 'sqlite://' ):
|
||||
kwargs['database_engine_option_max_overflow'] = '20'
|
||||
|
||||
if tool_dependency_dir is not None:
|
||||
kwargs['tool_dependency_dir'] = tool_dependency_dir
|
||||
|
||||
# Build the Universe Application
|
||||
app = UniverseApplication( job_queue_workers = 5,
|
||||
id_secret = 'changethisinproductiontoo',
|
||||
|
||||
@@ -624,6 +624,14 @@ class TwillTestCase( unittest.TestCase ):
|
||||
fd,temp_prefix = tempfile.mkstemp(prefix='tmp',suffix=suffix)
|
||||
return temp_prefix
|
||||
|
||||
def get_history_dataset_stdout( self, hda_id ):
|
||||
self.visit_page( "/datasets/%s/stdout" % hda_id )
|
||||
return self.last_page()
|
||||
|
||||
def get_history_dataset_stderr( self, hda_id ):
|
||||
self.visit_page( "/datasets/%s/stderr" % hda_id )
|
||||
return self.last_page()
|
||||
|
||||
def verify_dataset_correctness( self, filename, hid=None, wait=True, maxseconds=120, attributes=None ):
|
||||
"""Verifies that the attributes and contents of a history item meet expectations"""
|
||||
if wait:
|
||||
|
||||
@@ -93,7 +93,19 @@ class ToolTestCase( TwillTestCase ):
|
||||
self.assertTrue( elem is not None )
|
||||
elem_hid = elem.get( 'hid' )
|
||||
elem_index += 1
|
||||
self.verify_dataset_correctness( outfile, hid=elem_hid, maxseconds=testdef.maxseconds, attributes=attributes )
|
||||
try:
|
||||
self.verify_dataset_correctness( outfile, hid=elem_hid, maxseconds=testdef.maxseconds, attributes=attributes )
|
||||
except Exception, e:
|
||||
print '-----------'
|
||||
print 'Job STDOUT:'
|
||||
print '-----------'
|
||||
print self.get_history_dataset_stdout( elem.get( 'id' ) )
|
||||
print '-----------'
|
||||
print 'Job STDERR:'
|
||||
print '-----------'
|
||||
print self.get_history_dataset_stderr( elem.get( 'id' ) )
|
||||
print '-----------'
|
||||
raise
|
||||
self.delete_history( id=self.security.encode_id( latest_history.id ) )
|
||||
|
||||
def __expand_grouping( self, tool_inputs, declared_inputs, prefix='' ):
|
||||
|
||||
Reference in New Issue
Block a user