예제 #1
0
def start():
    is_config = os.path.exists(os.path.join(os.getcwd(), 'config.py'))
    is_yaml = os.path.exists(
        os.path.join(os.getcwd(), 'deployment/docker-compose.yaml'))
    is_env = os.path.exists(os.path.join(os.getcwd(), 'env/.env'))

    if is_config and is_env and is_yaml:

        # find available port
        # init_ui_port = 8081
        # ui_port = get_available_port(init_ui_port)
        #
        # if ui_port != init_ui_port:
        #     click.echo('Warning: port ' + str(init_ui_port) +' already in use, using ' + str(ui_port) + ' instead.')

        # set env file
        set_env(env_filename='.env')

        # start command
        cmd = "docker-compose up"

        # set cwd to deployment folder
        os.chdir(os.path.join(os.getcwd(), "deployment"))

        os.system(cmd)

        # set cwd back to root
        os.chdir("../")
    else:
        click.secho(
            "ERROR: Please run 'mlapp mlcp setup' command before starting.",
            fg='red')
예제 #2
0
def stop():
    # set env file
    set_env(env_filename='')

    # set cwd to deployment folder
    os.chdir(os.path.join(os.getcwd(), "deployment"))

    cmd = "docker-compose down"
    os.system(cmd)

    # set cwd back to root
    os.chdir("../")