def process_state(datas, fails, stop, force, is_initializing, is_running, msg): ret = { "has_exited": False, "is_initializing": is_initializing, "is_running": is_running } status = datas['result']['status'] if len(fails) > 0: if status != 'TERMINATED' and stop: print("\nStopping test, force={0}".format(force)) tools.set_batch(True) running_tools.stop(datas["id"], force) ret["has_exited"] = True elif status == 'TERMINATED': ret["has_exited"] = True elif status == 'INIT': printif(not is_initializing, 'Initializing', end='') is_initializing = True elif status == 'RUNNING': printif(not is_running, '\nRunning', end='') is_running = True ret["is_initializing"] = is_initializing ret["is_running"] = is_running return ret
def cli(debug, batch): if debug: logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) requests_log = logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.DEBUG) requests_log.propagate = True cli_exception.CliException.set_debug(True) tools.set_batch(batch) coloredlogs.install(level=logging.getLogger().level)
def cli(debug, batch): if debug: logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) requests_log = logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.DEBUG) requests_log.propagate = True cli_exception.CliException.set_debug(True) tools.set_batch(batch) if batch: sys.stdin = open(os.devnull, 'r') if tools.is_color_terminal(): coloredlogs.install(level=logging.getLogger().level)
def process_state(datas, fails, fail_options, is_initializing, is_running): stop = fail_options['stop'] force = fail_options['force'] stop_command = fail_options['stop_command'] ret = { "has_exited": False, "is_initializing": is_initializing, "is_running": is_running } status = datas['result']['status'] if len(fails) > 0: if status != 'TERMINATED' and stop: if stop_command is not None: out = subprocess.run(stop_command, shell=True, capture_output=True) print( f"\nStopping test with the system command {out.args}\n - return code={out.returncode}" ) print(f" - stdout={out.stdout}\n - stderr={out.stderr}") else: print("\nStopping test, force={0}".format(force)) tools.set_batch(True) running_tools.stop(datas["id"], force) ret["has_exited"] = True elif status == 'TERMINATED': ret["has_exited"] = True elif status == 'INIT': printif(not is_initializing, 'Initializing', end='') is_initializing = True elif status == 'RUNNING': printif(not is_running, '\nRunning', end='') is_running = True ret["is_initializing"] = is_initializing ret["is_running"] = is_running return ret