Beispiel #1
0
def delete_deployment(target, name):
    """
    Delete the deployment with name given at `--name` from the specified target.
    """
    client = interface.get_deploy_client(target)
    client.delete_deployment(name)
    click.echo("Deployment {} is deleted".format(name))
Beispiel #2
0
def list_deployment(target):
    """
    List the names of all model deployments in the specified target. These names can be used with
    the `delete`, `update`, and `get` commands.
    """
    client = interface.get_deploy_client(target)
    ids = client.list_deployments()
    click.echo("List of all deployments:\n{}".format(ids))
Beispiel #3
0
def get_deployment(target, name):
    """
    Print a detailed description of the deployment with name given at ``--name`` in the specified
    target.
    """
    client = interface.get_deploy_client(target)
    desc = client.get_deployment(name)
    for key, val in desc.items():
        click.echo("{}: {}".format(key, val))
    click.echo('\n')
Beispiel #4
0
def create_deployment(flavor, model_uri, target, name, config):
    """
    Deploy the model at ``model_uri`` to the specified target.

    Additional plugin-specific arguments may also be passed to this command, via `-C key=value`
    """
    config_dict = _user_args_to_dict(config)
    client = interface.get_deploy_client(target)
    deployment = client.create_deployment(name,
                                          model_uri,
                                          flavor,
                                          config=config_dict)
    click.echo("\n{} deployment {} is created".format(deployment['flavor'],
                                                      deployment['name']))
Beispiel #5
0
def update_deployment(flavor, model_uri, target, name, config):
    """
    Update the deployment with ID `deployment_id` in the specified target.
    You can update the URI of the model and/or the flavor of the deployed model (in which case the
    model URI must also be specified).

    Additional plugin-specific arguments may also be passed to this command, via `-C key=value`.
    """
    config_dict = _user_args_to_dict(config)
    client = interface.get_deploy_client(target)
    ret = client.update_deployment(name,
                                   model_uri=model_uri,
                                   flavor=flavor,
                                   config=config_dict)
    click.echo("Deployment {} is updated (with flavor {})".format(
        name, ret['flavor']))