def local_run_long_until_success(name, cmd): attempt = 1 while attempt < 101: try: if attempt > 1: Static.msg("RETRYING", "VALIDATE in 15s") time.sleep(15) Cmd.local_run_long(name, cmd) return except: attempt += 1
def local_run_long_until_ready(name, cmd): result = False while not result: proc1 = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, preexec_fn=os.setsid) proc1.wait() for line in iter(proc1.stdout.readline, ''): if not "ready: true" in line: Static.msg("Waiting for", name.upper()) time.sleep(10) continue Static.msg("Success for", name.upper()) return