Commits

Dannon Baker committed 0af879f

Migration 104 was using a Session() object that conflicts with the threadlocal strategy, which has been causing the '103 is not 105' migration errors we've seen. scoped_session works, but the threadlocal should probably be completely deprecated moving forward (removed from universe_wsgi.ini.sample by nate just now). See http://docs.sqlalchemy.org/en/rel_0_9/core/connections.html#threadlocal-strategy

Comments (0)

Files changed (1)

lib/galaxy/model/migrate/versions/0104_update_genome_downloader_job_parameters.py

 handler.setFormatter( formatter )
 log.addHandler( handler )
 
+metadata = MetaData()
+context = scoped_session( sessionmaker( autoflush=False, autocommit=True ) )
 
 class DeferredJob( object ):
     states = Bunch( NEW = 'new',
         self.params = params
 
 def upgrade(migrate_engine):
-    metadata = MetaData()
     metadata.bind = migrate_engine
 
-    Session = sessionmaker( bind=migrate_engine)
-    context = Session()
-
     DeferredJob.table = Table( "deferred_job", metadata,
         Column( "id", Integer, primary_key=True ),
         Column( "create_time", DateTime, default=now ),
     context.flush()
 
 def downgrade(migrate_engine):
-    metadata = MetaData()
     metadata.bind = migrate_engine
 
-    Session = sessionmaker( bind=migrate_engine)
-    context = Session()
-
     jobs = context.query( DeferredJob ).filter_by( plugin='GenomeTransferPlugin' ).all()
 
     for job in jobs: