diff --git a/supervisord.py b/supervisord.py index 57dc6804934f061dc3a3b91e33f0d5ade2433d8e_c3VwZXJ2aXNvcmQucHk=..b3bf2ad04df4b055d21c8bd1f8e22b3655ab70c7_c3VwZXJ2aXNvcmQucHk= 100644 --- a/supervisord.py +++ b/supervisord.py @@ -160,6 +160,7 @@ command: bytes program_name: bytes autostart: bool + priority: int stdout_logfile: bytes stderr_logfile: bytes startsecs: int @@ -188,6 +189,7 @@ command: str, process_name: str, autostart: bool, + priority: int, stdout_file: str, stderr_file: str, startsecs: int, @@ -205,6 +207,7 @@ self.command = command.encode() self.process_name = process_name.encode() self.autostart = autostart + self.priority = priority self.stdout_file = stdout_file.encode() self.stderr_file = stderr_file.encode() self.startsecs = startsecs @@ -656,7 +659,7 @@ t_astctxt = qio_procterm(fterm) # noqa: F841 c_astctxt = qio_cmd(fcmd) # noqa: F841 - for pgm in Program.programs.values(): + for pgm in sorted(Program.programs.values(), key=lambda pgm: pgm.priority): if pgm.autostart: pgm.create_process(False) @@ -747,6 +750,7 @@ command = config[sn].get('command') stdout_file = config[sn].get('stdout_file', 'NLA0:') stderr_file = config[sn].get('stderr_file', 'NLA0:') + priority = config[sn].getint('priority', 999) startsecs = config[sn].getint('startsecs', 10) startretries = config[sn].getint('startretries', 3) stopwaitsecs = config[sn].getint('stopwaitsescs', 10) @@ -761,6 +765,7 @@ command=command, process_name=process_name, autostart=autostart, + priority=priority, stdout_file=stdout_file, stderr_file=stderr_file, startsecs=startsecs,