Example #1
0
def reg(port: Optional[int] = typer.Option(
    8000, help="The port the Orchest webserver will listen on.")):
    """
    Start Orchest regularly.

    This is the default mode in which Orchest is started. Alias:

    \b
        orchest start [OPTIONS]
    """
    container_config = get_container_config("reg")

    port_bind: dict = {
        "nginx-proxy": {
            "HostConfig": {
                "PortBindings": {
                    "80/tcp": [{
                        "HostPort": f"{port}"
                    }],
                },
            },
        },
    }
    inject_dict(container_config, port_bind, overwrite=True)
    app.start(container_config)
Example #2
0
def dev(
    port: Optional[int] = typer.Option(
        8000, help="The port the Orchest webserver will listen on."),
    log_level: Optional[LogLevel] = typer.Option(
        None,
        "-l",
        "--log-level",
        show_default=False,
        help="Log level inside the application.",
    ),
):
    """
    Start Orchest in DEV mode.

    Starting Orchest in DEV mode mounts the repository code from the
    filesystem (and thus adhering to branches) to the appropriate paths
    in the Docker containers. This allows for active code changes being
    reflected inside the application.
    """
    container_config = get_container_config("dev")

    port_bind: dict = {
        "nginx-proxy": {
            "HostConfig": {
                "PortBindings": {
                    "80/tcp": [{
                        "HostPort": f"{port}"
                    }],
                },
            },
        },
    }
    inject_dict(container_config, port_bind, overwrite=True)

    if log_level is not None:
        logging_env = f"ORCHEST_LOG_LEVEL={log_level.value}"
        log_levels: dict = {
            "orchest-webserver": {
                "Env": [logging_env],
            },
            "orchest-api": {
                "Env": [logging_env],
            },
            "auth-server": {
                "Env": [logging_env],
            },
            "celery-worker": {
                "Env": [logging_env],
            },
        }
        inject_dict(container_config, log_levels, overwrite=False)

    logger.info("Starting Orchest in DEV mode. This mounts host directories "
                "to monitor for source code changes.")
    app.start(container_config)
Example #3
0
def restart(
    mode: Mode = typer.Option(
        Mode.reg, help="Mode in which to start Orchest afterwards."
    ),
    port: Optional[int] = typer.Option(
        8000, help="The port the Orchest webserver will listen on."
    ),
):
    """
    Restart Orchest.
    """
    container_config = get_container_config(mode.value)
    port_bind: dict = {
        "nginx-proxy": {
            "HostConfig": {
                "PortBindings": {
                    "80/tcp": [{"HostPort": f"{port}"}],
                },
            },
        },
    }
    inject_dict(container_config, port_bind, overwrite=True)
    app.restart(container_config)
Example #4
0
def test_inject_dict(self, other, overwrite, expected):
    spec.inject_dict(self, other, overwrite=overwrite)
    assert self == expected