Changeset 1464:c7acaa1bb88f
- 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
| r1459 |
r1464 |
|
| 105 | 105 | def __init__( self, id=None, hid=None, name=None, info=None, blurb=None, peek=None, extension=None, |
|---|
| 106 | 106 | 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 ): |
|---|
| 108 | 108 | self.name = name or "Unnamed dataset" |
|---|
| 109 | 109 | self.id = id |
|---|
| … | … | |
| 126 | 126 | self.parent_id = parent_id |
|---|
| 127 | 127 | self.validation_errors = validation_errors |
|---|
| | 128 | self.copied_from_history_dataset_association = copied_from_history_dataset_association |
|---|
| 128 | 129 | |
|---|
| 129 | 130 | @property |
|---|
| … | … | |
| 253 | 254 | |
|---|
| 254 | 255 | 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 ) |
|---|
| 256 | 257 | des.flush() |
|---|
| 257 | 258 | if copy_children: |
|---|
| r1459 |
r1464 |
|
| 73 | 73 | Column( "create_time", DateTime, default=now ), |
|---|
| 74 | 74 | Column( "update_time", DateTime, default=now, onupdate=now ), |
|---|
| | 75 | Column( "copied_from_history_dataset_association_id", Integer, ForeignKey( "history_dataset_association.id" ), nullable=True ), |
|---|
| 75 | 76 | Column( "hid", Integer ), |
|---|
| 76 | 77 | Column( "name", TrimmedString( 255 ) ), |
|---|
| … | … | |
| 251 | 252 | History, |
|---|
| 252 | 253 | 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] ) ), |
|---|
| 253 | 258 | implicitly_converted_datasets=relation( |
|---|
| 254 | 259 | ImplicitlyConvertedDatasetAssociation, |
|---|
| … | … | |
| 257 | 262 | HistoryDatasetAssociation, |
|---|
| 258 | 263 | 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] ) ) |
|---|
| 260 | 265 | ) ) |
|---|
| 261 | 266 | |
|---|
| r1446 |
r1464 |
|
| 677 | 677 | warnings.add( "Some datasets still queued or running were ignored" ) |
|---|
| 678 | 678 | 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: |
|---|
| 682 | 689 | job = assoc.job |
|---|
| 683 | 690 | if job in jobs: |
|---|