This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

Executing of multiple triggered events in serialized way rather than multiple events at once

Hi,

I am getting the following status when I am trying to run “st2ctl status” as shown below:

[root@sftyautomation-node1 ~]# st2ctl status
##### st2 components status #####
**st2actionrunner PID: 17420**
**st2actionrunner PID: 17423**
**st2actionrunner PID: 17428**
**st2actionrunner PID: 17433**
**st2actionrunner PID: 17439**
**st2actionrunner PID: 17442**
**st2actionrunner PID: 17447**
**st2actionrunner PID: 17456**
**st2actionrunner PID: 17461**
**st2actionrunner PID: 17472**
st2api PID: 17665
st2api PID: 19010
st2stream PID: 17777
st2stream PID: 19162
st2auth PID: 17832
st2auth PID: 19397
st2garbagecollector PID: 17972
st2notifier PID: 18045
st2resultstracker PID: 18132
st2rulesengine PID: 18279
st2sensorcontainer PID: 18368
st2chatops is not running.
st2timersengine PID: 18529
st2workflowengine PID: 18734
st2scheduler PID: 19006
mistral-server PID: 19252
mistral.api PID: 19251
mistral.api PID: 19503
mistral.api PID: 19504

So from the above output multiple st2actionrunners are getting executed.But my question is can’t I make that st2actionrunner to run only with one pid instead of multiple pids. Is there any steps that need to configured for that to get into reflection.I have highlighted in the above output.

Number of action runner processes which are started can be changed in a script file which is used by service managers (upstart, systemd, etc.) - st2-packages/runners.sh at master · StackStorm/st2-packages · GitHub

This file should be located at /opt/stackstorm/st2/bin/runners.sh. You can edit the file directly (not the best approach) or edit corresponding service manager config file to set WORKERS environment variable to 1 (st2-packages/st2.st2actionrunner.upstart at master · StackStorm/st2-packages · GitHub, st2-packages/st2actionrunner.service at master · StackStorm/st2-packages · GitHub).

Hi Kami,

Thanks for you response,I have changed the values as you have mentioned.Here are the steps which I did.

  1. I have opened the /opt/stackstorm/st2/bin/runners.sh file.
  2. And changed “WORKERS=”${WORKERS:-1}"" as you said.
  3. Then for this to get reflected I have reloaded components by running “st2ctl reload”.

But there is no effect and below is the output after these changes:
[root@sftyautomation-node1 stackstorm]# st2ctl status

st2 components status

st2actionrunner PID: 17618
st2actionrunner PID: 31729
st2actionrunner PID: 31731
st2actionrunner PID: 31733
st2actionrunner PID: 31736
st2actionrunner PID: 31739
st2actionrunner PID: 31742
st2actionrunner PID: 31745
st2actionrunner PID: 31749
st2actionrunner PID: 31752
st2api PID: 17690
st2api PID: 17797
st2stream PID: 17732
st2stream PID: 17831
st2auth PID: 17859
st2auth PID: 17946
st2garbagecollector PID: 17978
st2notifier PID: 18074
st2resultstracker PID: 18159
st2rulesengine PID: 18249
st2sensorcontainer PID: 18340
st2chatops is not running.
st2timersengine PID: 18546
st2workflowengine PID: 18624
st2scheduler PID: 18843
mistral-server PID: 18915
mistral.api PID: 18913
mistral.api PID: 19155
mistral.api PID: 19157

Also I have tested with restarting the components by running “st2ctl restart”.

@AcharyaTejaswi What’s your initial installation method of StackStorm and OS env where st2 was deployed?

Hi Armab,

I have installed using the stackstorm documents as per the instructions mentioned in the below link:
https://docs.stackstorm.com/2.9/install/rhel7.html

The OS details are:

  1. Centos 7
  2. Disk Size: 107GB
  3. CPU: 4
  4. RAM: 12GB

Create /etc/sysconfig/st2actionrunner file with the following contents:

WORKERS=1

Then restart st2actionrunner component to pick up new changes:

sudo systemctl restart st2actionrunner

What’s the problem you’re trying to solve here @AcharyaTejaswi?

Yes, you can change the number of action runners to 1. But that doesn’t seem like a good idea to me. Feels like a blunt workaround to something else. What’s the bigger picture here? There’s probably a better way to achieve whatever you’re trying to do

@AcharyaTejaswi The st2ctl reload command will not restart any of the running StackStorm processes/daemons. You need to run st2ctl restart for daemon configuration changes to take effect. Note the difference: reload versus restart.

Also, if all you are trying to do is ensure that triggered actions run in series, the proper way to configure that is to use a policy.

Please see our documentation, including examples, on policies here:
https://docs.stackstorm.com/reference/policies.html

Thanks to everyone for your precious responses.
I have stopped the st2 components and started the components using the commands
“st2ctl stop”
“st2ctl start”

Now that is working as I am expecting.Here is the output.
[root@sftyautomation-node1 ~]# st2ctl status

st2 components status

st2actionrunner PID: 24459
st2api is not running.
st2stream is not running.
st2auth PID: 2688
st2auth PID: 5591
st2garbagecollector PID: 24483
st2notifier PID: 24458
st2resultstracker PID: 24502
st2rulesengine PID: 24658
st2sensorcontainer PID: 24603
st2chatops is not running.
st2timersengine PID: 24577
st2workflowengine PID: 24480
st2scheduler is not running.
mistral-server PID: 2705
mistral.api PID: 2692
mistral.api PID: 6097
mistral.api PID: 6098

@lhill Actually what I am trying to do here is?

  1. We have installed the kafka packs in the stackstorm and configured a topic for producing events.
  2. And we built a custom pack using python for consuming the kafka messages.
  3. Now come the actual flow, using a python script we are dynamically pumping 20 to 30 events into this kafka topic…then for these 20 or 30 events the built workflow( which includes around 12 to 15 action tasks ) getting executed parallely because of this the execution time of all the events getting exponentially large.So I want to make into a serialized way like until the 1st event’s workflow gets completed the 2nd workflow should not get started…follows the same until the last event…For this way of implementation should I need to change any properties or etc in stackstorm…is my question.

See the previous posts about using policies. Or tune/size your system to handle more concurrent workflows

Thank you @lhill, I will go through the link.