[hg] galaxy 3483: Fix for running workflows with steps that don'...
details: http://www.bx.psu.edu/hg/galaxy/rev/c349f517ffb8 changeset: 3483:c349f517ffb8 user: James Taylor <james@jamestaylor.org> date: Thu Mar 04 13:55:21 2010 -0500 description: Fix for running workflows with steps that don't have jobs diffstat: lib/galaxy/model/mapping.py | 2 +- lib/galaxy/model/migrate/versions/0042_workflow_invocation_fix.py | 62 ++++++++++ 2 files changed, 63 insertions(+), 1 deletions(-) diffs (79 lines): diff -r 66fda01625f3 -r c349f517ffb8 lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py Thu Mar 04 13:49:09 2010 -0500 +++ b/lib/galaxy/model/mapping.py Thu Mar 04 13:55:21 2010 -0500 @@ -571,7 +571,7 @@ Column( "update_time", DateTime, default=now, onupdate=now ), Column( "workflow_invocation_id", Integer, ForeignKey( "workflow_invocation.id" ), index=True, nullable=False ), Column( "workflow_step_id", Integer, ForeignKey( "workflow_step.id" ), index=True, nullable=False ), - Column( "job_id", Integer, ForeignKey( "job.id" ), index=True, nullable=False ) + Column( "job_id", Integer, ForeignKey( "job.id" ), index=True, nullable=True ) ) StoredWorkflowUserShareAssociation.table = Table( "stored_workflow_user_share_connection", metadata, diff -r 66fda01625f3 -r c349f517ffb8 lib/galaxy/model/migrate/versions/0042_workflow_invocation_fix.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/galaxy/model/migrate/versions/0042_workflow_invocation_fix.py Thu Mar 04 13:55:21 2010 -0500 @@ -0,0 +1,62 @@ +""" +Drop and readd workflow invocation tables, allowing null jobs +""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * + +import logging +logging.basicConfig( level=logging.DEBUG ) +log = logging.getLogger( __name__ ) + +import datetime +now = datetime.datetime.utcnow + +def upgrade(): + print __doc__ + + metadata = MetaData( migrate_engine ) + db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) + metadata.reflect() + + # 1) Drop + + for table_name in [ "workflow_invocation_step", "workflow_invocation" ]: + try: + t = Table( table_name, metadata, autoload=True ).drop() + except: + log.exception( "Failed to drop table '%s', ignoring (might result in wrong schema)" % table_name ) + + # 2) Readd + + metadata = MetaData( migrate_engine ) + db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) ) + metadata.reflect() + + WorkflowInvocation_table = Table( "workflow_invocation", metadata, + Column( "id", Integer, primary_key=True ), + Column( "create_time", DateTime, default=now ), + Column( "update_time", DateTime, default=now, onupdate=now ), + Column( "workflow_id", Integer, ForeignKey( "workflow.id" ), index=True, nullable=False ), + ) + + WorkflowInvocationStep_table = Table( "workflow_invocation_step", metadata, + Column( "id", Integer, primary_key=True ), + Column( "create_time", DateTime, default=now ), + Column( "update_time", DateTime, default=now, onupdate=now ), + Column( "workflow_invocation_id", Integer, ForeignKey( "workflow_invocation.id" ), index=True, nullable=False ), + Column( "workflow_step_id", Integer, ForeignKey( "workflow_step.id" ), index=True, nullable=False ), + Column( "job_id", Integer, ForeignKey( "job.id" ), index=True, nullable=True ), + ) + + for table in [ WorkflowInvocation_table, WorkflowInvocationStep_table ]: + try: + table.create() + except: + log.exception( "Failed to create table '%s', ignoring (might result in wrong schema)" % table.name ) + +def downgrade(): + # No downgrade + pass \ No newline at end of file
participants (1)
-
Greg Von Kuster