mirror of https://github.com/zulip/zulip.git
supervisor: Add a filter for only(-not)-running.
This commit is contained in:
parent
7243c3c73d
commit
88c3f560ae
|
@ -27,7 +27,9 @@ def rpc() -> client.ServerProxy:
|
|||
)
|
||||
|
||||
|
||||
def list_supervisor_processes(*filter_names: str) -> List[str]:
|
||||
def list_supervisor_processes(
|
||||
filter_names: Optional[List[str]] = None, *, only_running: Optional[bool] = None
|
||||
) -> List[str]:
|
||||
results = []
|
||||
processes = rpc().supervisor.getAllProcessInfo()
|
||||
assert isinstance(processes, list)
|
||||
|
@ -49,5 +51,8 @@ def list_supervisor_processes(*filter_names: str) -> List[str]:
|
|||
if not match:
|
||||
continue
|
||||
|
||||
results.append(name)
|
||||
if only_running is None:
|
||||
results.append(name)
|
||||
elif only_running == (process["statename"] == "RUNNING"):
|
||||
results.append(name)
|
||||
return results
|
||||
|
|
|
@ -71,7 +71,7 @@ if has_application_server():
|
|||
if action == "start" or args.less_graceful:
|
||||
workers.append("zulip-workers:*")
|
||||
else:
|
||||
workers.extend(list_supervisor_processes("zulip-workers:*"))
|
||||
workers.extend(list_supervisor_processes(["zulip-workers:*"]))
|
||||
|
||||
if has_application_server(once=True):
|
||||
# These used to be included in "zulip-workers:*"; since we may
|
||||
|
@ -81,8 +81,10 @@ if has_application_server():
|
|||
# `supervisorctl`.
|
||||
workers.extend(
|
||||
list_supervisor_processes(
|
||||
"zulip_deliver_scheduled_emails",
|
||||
"zulip_deliver_scheduled_messages",
|
||||
[
|
||||
"zulip_deliver_scheduled_emails",
|
||||
"zulip_deliver_scheduled_messages",
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -48,8 +48,10 @@ if has_application_server():
|
|||
# if they currently exist according to `supervisorctl`.
|
||||
services.extend(
|
||||
list_supervisor_processes(
|
||||
"zulip_deliver_scheduled_emails",
|
||||
"zulip_deliver_scheduled_messages",
|
||||
[
|
||||
"zulip_deliver_scheduled_emails",
|
||||
"zulip_deliver_scheduled_messages",
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue