mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-19 05:19:40 +02:00
fix
This commit is contained in:
parent
44cb9588fc
commit
e8d3b7f682
1 changed files with 20 additions and 17 deletions
|
@ -809,6 +809,23 @@ def move_to_script_folder():
|
|||
|
||||
# --------------------------------------
|
||||
|
||||
def get_enabled_workers():
|
||||
config_dir = Path("~/pandora/pandora/workers")
|
||||
yml_files = list(config_dir.glob("*.yml"))
|
||||
return [str(file.stem) for file in yml_files if file.stem is not None]
|
||||
|
||||
def wait_for_workers():
|
||||
pandora = pypandora.PyPandora(root_url=pandora_root_url)
|
||||
target_count = len(get_enabled_workers()) - 1
|
||||
while True:
|
||||
workers = pandora.get_enabled_workers()
|
||||
log(f"Workers ready : {len(workers)}/ {target_count}")
|
||||
if len(workers) >= target_count:
|
||||
break
|
||||
time.sleep(2)
|
||||
|
||||
# --------------------------------------
|
||||
|
||||
|
||||
def startup():
|
||||
"""Start Pandora-box"""
|
||||
|
@ -827,6 +844,9 @@ def startup():
|
|||
# Print logo screen
|
||||
print_screen()
|
||||
|
||||
# Wait for workers
|
||||
wait_for_workers()
|
||||
|
||||
return "WAIT"
|
||||
|
||||
|
||||
|
@ -876,23 +896,6 @@ def get_lock(process_name):
|
|||
|
||||
# --------------------------------------
|
||||
|
||||
def get_enabled_workers():
|
||||
config_dir = Path("~/pandora/pandora/workers")
|
||||
yml_files = list(config_dir.glob("*.yml"))
|
||||
return [str(file.stem) for file in yml_files if file.stem is not None]
|
||||
|
||||
def wait_for_workers():
|
||||
pandora = pypandora.PyPandora(root_url=pandora_root_url)
|
||||
target_count = len(get_enabled_workers()) - 1
|
||||
while True:
|
||||
workers = 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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue