示例#1
0
def test_plugin_doesnot_have_required_attrib():
    class DummyPlugin:
        ...  # pylint: disable=pointless-statement

    dummy_plugin = DummyPlugin()
    plugin_manager = DeploymentPlugins()
    plugin_manager.registry["dummy"] = dummy_plugin
    with pytest.raises(MlflowException):
        plugin_manager["dummy"]  # pylint: disable=pointless-statement
示例#2
0
import inspect
from mlflow.deployments.plugin_manager import DeploymentPlugins
from mlflow.deployments.base import BaseDeploymentClient
from mlflow.utils.annotations import experimental
from mlflow.deployments.utils import parse_target_uri

plugin_store = DeploymentPlugins()


def get_deploy_client(target_uri):
    """
    Returns a subclass of :py:class:`mlflow.deployments.BaseDeploymentClient` exposing standard
    APIs for deploying models to the specified target. See available deployment APIs
    by calling ``help()`` on the returned object or viewing docs for
    :py:class:`mlflow.deployments.BaseDeploymentClient`. You can also run
    ``mlflow deployments help -t <target-uri>`` via the CLI for more details on target-specific
    configuration options.

    :param target_uri: URI of target to deploy to.


    .. code-block:: python
        :caption: Example

        from mlflow.deployments import get_deploy_client
        import pandas as pd
        client = get_deploy_client('redisai')
        # Deploy the model stored at artifact path 'myModel' under run with ID 'someRunId'. The
        # model artifacts are fetched from the current tracking server and then used for deployment.
        client.create_deployment("spamDetector", "runs:/someRunId/myModel")
        # Load a CSV of emails and score it against our deployment
示例#3
0
import inspect
from mlflow.deployments.plugin_manager import DeploymentPlugins
from mlflow.deployments.base import BaseDeploymentClient
from mlflow.deployments.utils import parse_target_uri

plugin_store = DeploymentPlugins()
plugin_store.register("sagemaker", "mlflow.sagemaker")


def get_deploy_client(target_uri):
    """
    Returns a subclass of :py:class:`mlflow.deployments.BaseDeploymentClient` exposing standard
    APIs for deploying models to the specified target. See available deployment APIs
    by calling ``help()`` on the returned object or viewing docs for
    :py:class:`mlflow.deployments.BaseDeploymentClient`. You can also run
    ``mlflow deployments help -t <target-uri>`` via the CLI for more details on target-specific
    configuration options.

    :param target_uri: URI of target to deploy to.


    .. code-block:: python
        :caption: Example

        from mlflow.deployments import get_deploy_client
        import pandas as pd
        client = get_deploy_client('redisai')
        # Deploy the model stored at artifact path 'myModel' under run with ID 'someRunId'. The
        # model artifacts are fetched from the current tracking server and then used for deployment.
        client.create_deployment("spamDetector", "runs:/someRunId/myModel")
        # Load a CSV of emails and score it against our deployment