Changeset 1464:c7acaa1bb88f

Show
Ignore:
Timestamp:
08/01/08 15:05:54 (4 months ago)
Author:
dan@scofield.bx.psu.edu
branch:
default
Message:

Fix for the creation of workflows from shared histories.

Added a column 'copied_from_history_dataset_association' to history_dataset_association. This requires a db change.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/galaxy/model/__init__.py

    r1459 r1464  
    105105    def __init__( self, id=None, hid=None, name=None, info=None, blurb=None, peek=None, extension=None,  
    106106                  dbkey=None, metadata=None, history=None, dataset=None, deleted=False, designation=None, 
    107                   parent_id=None, validation_errors=None, visible=True, create_dataset = False ): 
     107                  parent_id=None, copied_from_history_dataset_association = None, validation_errors=None, visible=True, create_dataset = False ): 
    108108        self.name = name or "Unnamed dataset" 
    109109        self.id = id 
     
    126126        self.parent_id = parent_id 
    127127        self.validation_errors = validation_errors 
     128        self.copied_from_history_dataset_association = copied_from_history_dataset_association 
    128129     
    129130    @property 
     
    253254     
    254255    def copy( self, copy_children = False, parent_id = None ): 
    255         des = HistoryDatasetAssociation( hid=self.hid, name=self.name, info=self.info, blurb=self.blurb, peek=self.peek, extension=self.extension, dbkey=self.dbkey, metadata=self._metadata, dataset = self.dataset, visible=self.visible, deleted=self.deleted, parent_id=parent_id
     256        des = HistoryDatasetAssociation( hid=self.hid, name=self.name, info=self.info, blurb=self.blurb, peek=self.peek, extension=self.extension, dbkey=self.dbkey, metadata=self._metadata, dataset = self.dataset, visible=self.visible, deleted=self.deleted, parent_id=parent_id, copied_from_history_dataset_association = self
    256257        des.flush() 
    257258        if copy_children: 
  • lib/galaxy/model/mapping.py

    r1459 r1464  
    7373    Column( "create_time", DateTime, default=now ), 
    7474    Column( "update_time", DateTime, default=now, onupdate=now ), 
     75    Column( "copied_from_history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), nullable=True ), 
    7576    Column( "hid", Integer ), 
    7677    Column( "name", TrimmedString( 255 ) ), 
     
    251252            History,  
    252253            primaryjoin=( History.table.c.id == HistoryDatasetAssociation.table.c.history_id ) ), 
     254        copied_to_history_dataset_associations=relation(  
     255            HistoryDatasetAssociation,  
     256            primaryjoin=( HistoryDatasetAssociation.table.c.copied_from_history_dataset_association_id == HistoryDatasetAssociation.table.c.id ), 
     257            backref=backref( "copied_from_history_dataset_association", primaryjoin=( HistoryDatasetAssociation.table.c.copied_from_history_dataset_association_id == HistoryDatasetAssociation.table.c.id ), remote_side=[HistoryDatasetAssociation.table.c.id] ) ), 
    253258        implicitly_converted_datasets=relation(  
    254259            ImplicitlyConvertedDatasetAssociation,  
     
    257262            HistoryDatasetAssociation,  
    258263            primaryjoin=( HistoryDatasetAssociation.table.c.parent_id == HistoryDatasetAssociation.table.c.id ), 
    259             backref=backref( "parent", remote_side=[HistoryDatasetAssociation.table.c.id] ) ) 
     264            backref=backref( "parent", primaryjoin=( HistoryDatasetAssociation.table.c.parent_id == HistoryDatasetAssociation.table.c.id ), remote_side=[HistoryDatasetAssociation.table.c.id] ) ) 
    260265            ) ) 
    261266 
  • lib/galaxy/web/controllers/workflow.py

    r1446 r1464  
    677677            warnings.add( "Some datasets still queued or running were ignored" ) 
    678678            continue 
    679         if not dataset.creating_job_associations: 
    680             jobs[ FakeJob( dataset ) ] = [ ( None, dataset ) ]         
    681         for assoc in dataset.creating_job_associations: 
     679         
     680        #if this hda was copied from another, we need to find the job that created the origial hda 
     681        job_hda = dataset 
     682        while job_hda.copied_from_history_dataset_association: 
     683            job_hda = job_hda.copied_from_history_dataset_association 
     684         
     685        if not job_hda.creating_job_associations: 
     686            jobs[ FakeJob( dataset ) ] = [ ( None, dataset ) ] 
     687         
     688        for assoc in job_hda.creating_job_associations: 
    682689            job = assoc.job 
    683690            if job in jobs: