feature: add optional parameter depends_on attribute to start dependent processes consecutively #1449
+298
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this pull request I implemented an optional process parameter
depends_on
. This optional depends_on option is used to only start a process once the required process reached the RUNNING state, or else start all dependee processes first.Features:
spawn_timeout
.depends_on
parameter can be used with multiple dependencies which are seperated by a whitespace. If the process is part of a group the group name also has to be added before a colon (:).depends_on
) is especially useful in combination withrunningregex
attribute feature: add support for runningregex to set RUNNING state accordingly #1446 we always use this instead of startsecs to know when a process is actually ready and runningIn the following there are two minimal examples:
##################
In the following minimal example, "Hello World!" is printed.
[group:examplegroup]
programs=world
[program:hello]
command = /bin/sh -c "echo Hello"
autostart=false
autorestart=false
startsecs=0
stdout_logfile = ./log/hello_world.log
stderr_logfile = ./log/hello_world_err.log
[program:world]
command = /bin/sh -c "echo World"
autostart=false
autorestart=false
startsecs=0
stdout_logfile = ./log/hello_world.log
stderr_logfile = ./log/hello_world_err.log
[program:start_hello_world]
command = /bin/sh -c "echo !"
depends_on=hello examplegroup:world
autostart=true
autorestart=false
stdout_logfile = ./log/hello_world.log
stderr_logfile = ./log/hello_world_err.log
startsecs=0
###############
[program:foo]
command = /bin/sh -c "sleep 2 && echo foo (depends on bar) is running at && date && sleep 10"
autostart=true
autorestart=false
startsecs=0
stdout_logfile = ./logs/%(program_name)s_stdout.log
stderr_logfile = ./logs/%(program_name)s_stderr.log.log
runningregex=foo*is running at
depends_on:bar
[program:bar]
command = /bin/sh -c "sleep 80"
autostart=false
autorestart=false
startsecs=70
stdout_logfile = ./logs/%(program_name)s_stdout.log
stderr_logfile = ./logs/%(program_name)s_stderr.log
spawn_timeout=71