Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20.01] Run email post job action only once per implicit collection jobs #9277

Draft
wants to merge 3 commits into
base: release_20.01
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/galaxy/jobs/actions/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from markupsafe import escape

from galaxy.managers.jobs import summarize_jobs_to_dict
from galaxy.util import (
send_mail,
unicodify,
Expand Down Expand Up @@ -470,6 +471,8 @@ class ActionBox(object):
# being scheduled and jobs created.
immediate_actions = ['ChangeDatatypeAction', 'RenameDatasetAction',
'TagDatasetAction', 'RemoveTagDatasetAction']
# Actions that should happen only once per set of jobs
run_once = ['EmailAction']
# Actions that will be applied to implicit mapped over collection outputs and not
# just individual outputs when steps include mapped over tools and implicit collection outputs.
mapped_over_output_actions = ['RenameDatasetAction', 'HideDatasetAction',
Expand Down Expand Up @@ -511,5 +514,14 @@ def execute_on_mapped_over(cls, trans, sa_session, pja, step_inputs, step_output

@classmethod
def execute(cls, app, sa_session, pja, job, replacement_dict=None):
execute_action = True
if pja.action_type in ActionBox.actions:
if pja.action_type in ActionBox.run_once:
implicit_collection_jobs_association = job.implicit_collection_jobs_association
if implicit_collection_jobs_association:
summary = summarize_jobs_to_dict(sa_session, implicit_collection_jobs_association.implicit_collection_jobs)
# PJA get's executed prior to changing the job state,
# so the one running job should be this one.
execute_action = summary['states'].get('running', 1) == 1
if execute_action:
ActionBox.actions[pja.action_type].execute(app, sa_session, pja, job, replacement_dict)