mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-18 21:09:41 +02:00
add wait for workers to be ready
This commit is contained in:
parent
192414a369
commit
512589f636
2 changed files with 22 additions and 0 deletions
|
@ -153,6 +153,9 @@ su - $SUDO_USER -c "cd ~/pandora/pandora/workers; cp yarahub.yml.sample yarahq_f
|
|||
# Increase the number of replica
|
||||
su - $SUDO_USER -c "cd ~/pandora/pandora/workers; sed -i 's/replicas: 1/replicas: 5/' base.yml"
|
||||
|
||||
# Disable UNO Server -> "disable_unoserver": true,
|
||||
su - $SUDO_USER -c "cd ~/pandora/config; sed -i 's/\"disable_unoserver\"\: false/\"disable_unoserver\"\: true/' generic.json"
|
||||
|
||||
# remove some workers
|
||||
# rm pandora/workers/preview.yml
|
||||
|
||||
|
|
|
@ -875,10 +875,29 @@ def get_lock(process_name):
|
|||
|
||||
# --------------------------------------
|
||||
|
||||
def get_enabled_workers():
|
||||
config_dir = Path("~/pandora/pandora/workers")
|
||||
yml_files = list(config_dir.glob("*.yml"))
|
||||
return [file.stem for file in yml_files]
|
||||
|
||||
def wait_for_workers():
|
||||
target_count = get_enabled_workers() - 1
|
||||
while True:
|
||||
workers = self.pandora.get_enabled_workers()
|
||||
log(f"Workers ready : {len(workers)}/ {target_count}")
|
||||
if len(workers) >= target_count:
|
||||
break
|
||||
time.sleep(2)
|
||||
|
||||
# --------------------------------------
|
||||
|
||||
def main(_):
|
||||
"""Main entry point"""
|
||||
print("main")
|
||||
try:
|
||||
# Wait for workers to start
|
||||
|
||||
# Enter the mail loop
|
||||
state = "START"
|
||||
while state != "STOP":
|
||||
state = loop(state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue