commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9697f9fc92b1/ changeset: 9697f9fc92b1 user: inithello date: 2013-02-20 21:51:56 summary: Fix an import in the repository_revisions API controller. affected #: 1 file diff -r 1bd67f03d4f12d0f6cddacb57a6402cf306f8f55 -r 9697f9fc92b1bc8fbfaca72917eeff928c2cc4ac lib/galaxy/webapps/community/api/repository_revisions.py --- a/lib/galaxy/webapps/community/api/repository_revisions.py +++ b/lib/galaxy/webapps/community/api/repository_revisions.py @@ -1,10 +1,11 @@ -from galaxy import web, util, logging +from galaxy import web, util from galaxy.web.base.controller import BaseController, BaseAPIController from galaxy.web.framework.helpers import is_true import pkg_resources pkg_resources.require( "Routes" ) import routes +import logging log = logging.getLogger( __name__ ) https://bitbucket.org/galaxy/galaxy-central/commits/1adf6fdd9c49/ changeset: 1adf6fdd9c49 user: inithello date: 2013-02-20 21:52:10 summary: Add do_not_test, tools_functionally_correct, time_last_tested, and tool_test_errors columns to the repository_metadata table. affected #: 3 files diff -r 9697f9fc92b1bc8fbfaca72917eeff928c2cc4ac -r 1adf6fdd9c49bda204e5d90f70f10e7ef4ec06bd lib/galaxy/webapps/community/model/__init__.py --- a/lib/galaxy/webapps/community/model/__init__.py +++ b/lib/galaxy/webapps/community/model/__init__.py @@ -170,13 +170,18 @@ class RepositoryMetadata( object, APIItem ): api_collection_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'malicious', 'downloadable' ) api_element_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'malicious', 'downloadable' ) - def __init__( self, repository_id=None, changeset_revision=None, metadata=None, tool_versions=None, malicious=False, downloadable=False ): + def __init__( self, repository_id=None, changeset_revision=None, metadata=None, tool_versions=None, malicious=False, downloadable=False, + tools_functionally_correct=False, do_not_test=False, time_last_tested=None, tool_test_errors=None ): self.repository_id = repository_id self.changeset_revision = changeset_revision self.metadata = metadata or dict() self.tool_versions = tool_versions or dict() self.malicious = malicious self.downloadable = downloadable + self.tools_functionally_correct = tools_functionally_correct + self.do_not_test = do_not_test + self.time_last_tested = time_last_tested + self.tool_test_errors = tool_test_errors def get_api_value( self, view='collection', value_mapper=None ): if value_mapper is None: value_mapper = {} diff -r 9697f9fc92b1bc8fbfaca72917eeff928c2cc4ac -r 1adf6fdd9c49bda204e5d90f70f10e7ef4ec06bd lib/galaxy/webapps/community/model/mapping.py --- a/lib/galaxy/webapps/community/model/mapping.py +++ b/lib/galaxy/webapps/community/model/mapping.py @@ -130,7 +130,11 @@ Column( "metadata", JSONType, nullable=True ), Column( "tool_versions", JSONType, nullable=True ), Column( "malicious", Boolean, default=False ), - Column( "downloadable", Boolean, default=True ) ) + Column( "downloadable", Boolean, default=True ), + Column( "tools_functionally_correct", Boolean, default=False, index=True ), + Column( "do_not_test", Boolean, default=False, index=True ), + Column( "time_last_tested", DateTime, default=None, nullable=True ), + Column( "tool_test_errors", JSONType, nullable=True ) ) RepositoryReview.table = Table( "repository_review", metadata, Column( "id", Integer, primary_key=True ), diff -r 9697f9fc92b1bc8fbfaca72917eeff928c2cc4ac -r 1adf6fdd9c49bda204e5d90f70f10e7ef4ec06bd lib/galaxy/webapps/community/model/migrate/versions/0016_add_do_not_test_tools_functionally_correct_errors_columns.py --- /dev/null +++ b/lib/galaxy/webapps/community/model/migrate/versions/0016_add_do_not_test_tools_functionally_correct_errors_columns.py @@ -0,0 +1,99 @@ +""" +Migration script to add the tool_test_errors, do_not_test, tools_functionally_correct, and time_last_tested columns to the repository_metadata table. +""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * + +# Need our custom types, but don't import anything else from model +from galaxy.model.custom_types import * + +import sys, logging +log = logging.getLogger( __name__ ) +log.setLevel(logging.DEBUG) +handler = logging.StreamHandler( sys.stdout ) +format = "%(name)s %(levelname)s %(asctime)s %(message)s" +formatter = logging.Formatter( format ) +handler.setFormatter( formatter ) +log.addHandler( handler ) + +metadata = MetaData( migrate_engine ) +db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) + +def upgrade(): + print __doc__ + metadata.reflect() + # Create and initialize tools_functionally_correct, do_not_test, time_last_tested, and tool_test_errors columns in repository_metadata table. + RepositoryMetadata_table = Table( "repository_metadata", metadata, autoload=True ) + c = Column( "tools_functionally_correct", Boolean, default=False, index=True ) + try: + # Create tools_functionally_correct column + c.create( RepositoryMetadata_table ) + assert c is RepositoryMetadata_table.c.tools_functionally_correct + # Initialize. + if migrate_engine.name == 'mysql' or migrate_engine.name == 'sqlite': + default_false = "0" + elif migrate_engine.name == 'postgres': + default_false = "false" + db_session.execute( "UPDATE repository_metadata SET tools_functionally_correct=%s" % default_false ) + except Exception, e: + print "Adding tools_functionally_correct column to the repository_metadata table failed: %s" % str( e ) + log.debug( "Adding tools_functionally_correct column to the repository_metadata table failed: %s" % str( e ) ) + c = Column( "do_not_test", Boolean, default=False, index=True ) + try: + # Create do_not_test column + c.create( RepositoryMetadata_table ) + assert c is RepositoryMetadata_table.c.do_not_test + # Initialize. + if migrate_engine.name == 'mysql' or migrate_engine.name == 'sqlite': + default_false = "0" + elif migrate_engine.name == 'postgres': + default_false = "false" + db_session.execute( "UPDATE repository_metadata SET do_not_test=%s" % default_false ) + except Exception, e: + print "Adding do_not_test column to the repository_metadata table failed: %s" % str( e ) + log.debug( "Adding do_not_test column to the repository_metadata table failed: %s" % str( e ) ) + c = Column( "time_last_tested", DateTime, default=None, nullable=True ) + try: + # Create time_last_tested column + c.create( RepositoryMetadata_table ) + assert c is RepositoryMetadata_table.c.time_last_tested + except Exception, e: + print "Adding time_last_tested column to the repository_metadata table failed: %s" % str( e ) + log.debug( "Adding time_last_tested column to the repository_metadata table failed: %s" % str( e ) ) + c = Column( "tool_test_errors", JSONType, nullable=True ) + try: + pass + # Create tool_test_errors column + c.create( RepositoryMetadata_table ) + assert c is RepositoryMetadata_table.c.tool_test_errors + except Exception, e: + print "Adding tool_test_errors column to the repository_metadata table failed: %s" % str( e ) + log.debug( "Adding tool_test_errors column to the repository_metadata table failed: %s" % str( e ) ) + +def downgrade(): + metadata.reflect() + # Drop tool_test_errors, time_last_tested, do_not_test, and tools_functionally_correct columns from repository_metadata table. + RepositoryMetadata_table = Table( "repository_metadata", metadata, autoload=True ) + try: + RepositoryMetadata_table.c.tool_test_errors.drop() + except Exception, e: + print "Dropping column tool_test_errors from the repository_metadata table failed: %s" % str( e ) + log.debug( "Dropping column tool_test_errors from the repository_metadata table failed: %s" % str( e ) ) + try: + RepositoryMetadata_table.c.time_last_tested.drop() + except Exception, e: + print "Dropping column time_last_tested from the repository_metadata table failed: %s" % str( e ) + log.debug( "Dropping column time_last_tested from the repository_metadata table failed: %s" % str( e ) ) + try: + RepositoryMetadata_table.c.do_not_test.drop() + except Exception, e: + print "Dropping column do_not_test from the repository_metadata table failed: %s" % str( e ) + log.debug( "Dropping column do_not_test from the repository_metadata table failed: %s" % str( e ) ) + try: + RepositoryMetadata_table.c.tools_functionally_correct.drop() + except Exception, e: + print "Dropping column tools_functionally_correct from the repository_metadata table failed: %s" % str( e ) + log.debug( "Dropping column tools_functionally_correct from the repository_metadata table failed: %s" % str( e ) ) 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