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

Emit st2.generic.actiontrigger when action/wf is requested/scheduled/running #4312

Closed
shusugmt opened this issue Aug 21, 2018 · 3 comments
Closed

Comments

@shusugmt
Copy link
Contributor

SUMMARY

It is better for uses to have choice that st2.generic.actiontrigger be emitted not only on action complete, but when an action or workflow is transitioned into requested/scheduled/running state.

ISSUE TYPE
  • Feature Idea
Detail / Background / Motivation

While I was trying to implement a Slack notification at both start and end of the workflow, I noticed that st2.generic.actiontrigger is only emitted when the workflow reaches LIVEACTION_COMPLETED_STATES, which makes me hard to implement a notification for the start of the workflow.

My idea is to use st2.generic.actiontrigger and write a rule that hook state=running|succeeded by criteria, then run a Slack sendMessage action. I think this is the best approach and design because the target workflow that will be notified on start/end is completely separated from any of the notification code. So notification part is like an aspect and we can weave that into any workflow you like by writing a rule. I can clearly keep a separation of responsibility principle. Some examples:

  • All those configuration parameters needed for notification like tokens, channels, etc does not exist in the workflow code itself
  • The notification rules can even be placed in a different pack and separated from the release cycle of those core workflows (which are tend to be more important than notifications since they do real business logic)
  • If you want to weave notification, then you don't need to modify the target workflow. All you need is to write a rule. This makes us easy to add notification to the exchange pack workflows.

This is fairly easy to implement, but an impact to performance needs to be considered. So I think it is better to have a new config parameter and make this feature opt-in, like this.

@Kami Kami added this to the 3.0.0 milestone Aug 23, 2018
@Kami
Copy link
Member

Kami commented Aug 23, 2018

Thanks for the feedback - I think that's a reasonable feature request (and putting it behind a feature flag / config option is also a good idea).

@cognifloyd
Copy link
Member

I believe this is complete with #4315 and #4330.

@Kami Kami modified the milestones: 3.0.0, 2.9.0 Sep 24, 2018
@Kami Kami closed this as completed Sep 24, 2018
@Kami
Copy link
Member

Kami commented Sep 24, 2018

Yep - thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants