Skip to content

Commit

Permalink
Convert more state change stuff to SQL statements.
Browse files Browse the repository at this point in the history
Update HDCA update_time using SQL statement on job completion and convert SA update of workflow invocations over to this method also.
  • Loading branch information
jmchilton committed May 5, 2020
1 parent b337984 commit b557680
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions lib/galaxy/model/__init__.py
Expand Up @@ -1119,8 +1119,38 @@ def to_dict(self, view='collection', system_details=False):

def set_final_state(self, final_state):
self.set_state(final_state)
if self.workflow_invocation_step:
self.workflow_invocation_step.update()
statements = ['''
UPDATE history_dataset_collection_association
SET update_time = :update_time
WHERE id in (
SELECT hdca.id
FROM history_dataset_collection_association hdca
INNER JOIN implicit_collection_jobs icj
on icj.id = hdca.implicit_collection_jobs_id
INNER JOIN implicit_collection_jobs_job_association icjja
on icj.id = icjja.implicit_collection_jobs_id
WHERE icjja.job_id = :job_id
UNION
SELECT hdca2.id
FROM history_dataset_collection_association hdca2
WHERE hdca2.job_id = :job_id
);
''', '''
UPDATE workflow_invocation_step
SET update_time = :update_time
WHERE id in (
SELECT workflow_invocation_step.id
FROM workflow_invocation_step wis
WHERE wis.job_id = :job_id
);
''']
sa_session = object_session(self)
params = {
'job_id': self.id,
'update_time': galaxy.model.orm.now.now()
}
for statement in statements:
sa_session.execute(statement, params)

def get_destination_configuration(self, dest_params, config, key, default=None):
""" Get a destination parameter that can be defaulted back
Expand Down

0 comments on commit b557680

Please sign in to comment.