commit/galaxy-central: natefoo: Fix the dataset controller's stderr method and add one for stdout. Link to
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/3c9f7bfc1bcf/ changeset: 3c9f7bfc1bcf user: natefoo date: 2011-12-06 17:29:02 summary: 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. affected #: 4 files diff -r 0a901d00d8807a50017840e72fa37f2bf7cf2bcf -r 3c9f7bfc1bcf2be295c61857b836eb44b7dc8982 lib/galaxy/web/controllers/dataset.py --- a/lib/galaxy/web/controllers/dataset.py +++ b/lib/galaxy/web/controllers/dataset.py @@ -154,10 +154,24 @@ 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="" ): diff -r 0a901d00d8807a50017840e72fa37f2bf7cf2bcf -r 3c9f7bfc1bcf2be295c61857b836eb44b7dc8982 scripts/functional_tests.py --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -58,6 +58,7 @@ 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 @@ 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', diff -r 0a901d00d8807a50017840e72fa37f2bf7cf2bcf -r 3c9f7bfc1bcf2be295c61857b836eb44b7dc8982 test/base/twilltestcase.py --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -624,6 +624,14 @@ 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: diff -r 0a901d00d8807a50017840e72fa37f2bf7cf2bcf -r 3c9f7bfc1bcf2be295c61857b836eb44b7dc8982 test/functional/test_toolbox.py --- a/test/functional/test_toolbox.py +++ b/test/functional/test_toolbox.py @@ -93,7 +93,19 @@ 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='' ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket