diff --git a/fedn/cli/run_cmd.py b/fedn/cli/run_cmd.py index b5afa0fed..ae33c566c 100644 --- a/fedn/cli/run_cmd.py +++ b/fedn/cli/run_cmd.py @@ -43,8 +43,8 @@ def check_yaml_exists(path): click.echo(f"Could not find fedn.yaml in {path}") exit(-1) return yaml_file -def delete_virtual_environment(remove_venv,dispatcher): - if remove_venv: +def delete_virtual_environment(keep_venv, dispatcher): + if keep_venv: # delete the virtualenv if dispatcher.python_env_path: logger.info(f"Removing virtualenv {dispatcher.python_env_path}") @@ -61,9 +61,9 @@ def run_cmd(ctx): @click.option("-p", "--path", required=True, help="Path to package directory containing fedn.yaml") @click.option("-i", "--input", required=True, help="Path to input model" ) @click.option("-o", "--output", required=True, help="Path to write the output JSON containing validation metrics") -@click.option("-v", "--remove-venv", is_flag=True, default=True,required=False, help="flag if set to False doesn't remove venv") +@click.option("-v", "--keep-venv", is_flag=True, default=True, required=False, help="flag if set to False doesn't remove venv") @click.pass_context -def validate_cmd(ctx, path,input,output,remove_venv): +def validate_cmd(ctx, path, input, output, keep_venv): """Execute 'validate' entrypoint in fedn.yaml. :param ctx: @@ -82,14 +82,14 @@ def validate_cmd(ctx, path,input,output,remove_venv): dispatcher = Dispatcher(config, path) _ = dispatcher._get_or_create_python_env() dispatcher.run_cmd("validate {} {}".format(input, output)) - delete_virtual_environment(remove_venv,dispatcher) + delete_virtual_environment(keep_venv, dispatcher) @run_cmd.command("train") @click.option("-p", "--path", required=True, help="Path to package directory containing fedn.yaml") @click.option("-i", "--input", required=True, help="Path to input model parameters" ) @click.option("-o", "--output", required=True, help="Path to write the updated model parameters ") -@click.option("-v", "--remove-venv", is_flag=True, default=True,required=False, help="flag if set to False doesn't remove venv") +@click.option("-v", "--keep-venv", is_flag=True, default=True, required=False, help="flag if set to False doesn't remove venv") @click.pass_context -def train_cmd(ctx, path,input,output,remove_venv): +def train_cmd(ctx, path, input, output, keep_venv): """Execute 'train' entrypoint in fedn.yaml. :param ctx: @@ -108,13 +108,13 @@ def train_cmd(ctx, path,input,output,remove_venv): dispatcher = Dispatcher(config, path) _ = dispatcher._get_or_create_python_env() dispatcher.run_cmd("train {} {}".format(input, output)) - delete_virtual_environment(remove_venv,dispatcher) + delete_virtual_environment(keep_venv, dispatcher) @run_cmd.command("startup") @click.option("-p", "--path", required=True, help="Path to package directory containing fedn.yaml") -@click.option("-v", "--remove-venv", is_flag=True, default=True,required=False, help="flag if set to False doesn't remove venv") +@click.option("-v", "--keep-venv", is_flag=True, default=True, required=False, help="flag if set to False doesn't remove venv") @click.pass_context -def startup_cmd(ctx, path,remove_venv): +def startup_cmd(ctx, path, keep_venv): """Execute 'startup' entrypoint in fedn.yaml. :param ctx: @@ -129,18 +129,17 @@ def startup_cmd(ctx, path,remove_venv): if "startup" not in config["entry_points"]: logger.error("No startup command defined in fedn.yaml") exit(-1) - dispatcher = Dispatcher(config, path) _ = dispatcher._get_or_create_python_env() dispatcher.run_cmd("startup") - delete_virtual_environment(remove_venv,dispatcher) + delete_virtual_environment(keep_venv, dispatcher) @run_cmd.command("build") @click.option("-p", "--path", required=True, help="Path to package directory containing fedn.yaml") -@click.option("-v", "--remove-venv", is_flag=True, default=True,required=False, help="flag if set to False doesn't remove venv") +@click.option("-v", "--keep-venv", is_flag=True, default=True, required=False, help="flag if set to False doesn't remove venv") @click.pass_context -def build_cmd(ctx, path,remove_venv): +def build_cmd(ctx, path, keep_venv): """Execute 'build' entrypoint in fedn.yaml. :param ctx: @@ -159,8 +158,7 @@ def build_cmd(ctx, path,remove_venv): dispatcher = Dispatcher(config, path) _ = dispatcher._get_or_create_python_env() dispatcher.run_cmd("build") - print(remove_venv) - delete_virtual_environment(remove_venv,dispatcher) + delete_virtual_environment(keep_venv, dispatcher) diff --git a/fedn/network/api/gunicorn_app.py b/fedn/network/api/gunicorn_app.py index d4e822629..8c5cb0c30 100644 --- a/fedn/network/api/gunicorn_app.py +++ b/fedn/network/api/gunicorn_app.py @@ -15,7 +15,7 @@ def load(self): return self.application def run_gunicorn(app, host,port,workers=4): - bind_address=str(host)+":"+str(port) + bind_address = f"{host}:{port}" options = { "bind": bind_address, # Specify the bind address and port here "workers": workers, diff --git a/fedn/network/api/server.py b/fedn/network/api/server.py index 0c9806d86..5ede51116 100644 --- a/fedn/network/api/server.py +++ b/fedn/network/api/server.py @@ -637,6 +637,6 @@ def start_server_api(): app.run(debug=debug, port=port, host=host) else: workers=os.cpu_count() - gunicorn_app.run_gunicorn(app,host,port,workers) + gunicorn_app.run_gunicorn(app, host, port, workers) if __name__ == "__main__": start_server_api()