1. Packages
  2. Databricks
  3. API Docs
  4. getMlflowModel
Databricks v1.38.0 published on Monday, Apr 29, 2024 by Pulumi

databricks.getMlflowModel

Explore with Pulumi AI

databricks logo
Databricks v1.38.0 published on Monday, Apr 29, 2024 by Pulumi

    Note If you have a fully automated setup with workspaces created by databricks_mws_workspaces, please make sure to add depends_on attribute in order to prevent default auth: cannot configure default credentials errors.

    Retrieves the settings of databricks.MlflowModel by name.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const thisMlflowModel = new databricks.MlflowModel("this", {
        name: "My MLflow Model",
        description: "My MLflow model description",
        tags: [
            {
                key: "key1",
                value: "value1",
            },
            {
                key: "key2",
                value: "value2",
            },
        ],
    });
    const this = databricks.getMlflowModel({
        name: "My MLflow Model",
    });
    export const model = _this;
    
    import pulumi
    import pulumi_databricks as databricks
    
    this_mlflow_model = databricks.MlflowModel("this",
        name="My MLflow Model",
        description="My MLflow model description",
        tags=[
            databricks.MlflowModelTagArgs(
                key="key1",
                value="value1",
            ),
            databricks.MlflowModelTagArgs(
                key="key2",
                value="value2",
            ),
        ])
    this = databricks.get_mlflow_model(name="My MLflow Model")
    pulumi.export("model", this)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := databricks.NewMlflowModel(ctx, "this", &databricks.MlflowModelArgs{
    			Name:        pulumi.String("My MLflow Model"),
    			Description: pulumi.String("My MLflow model description"),
    			Tags: databricks.MlflowModelTagArray{
    				&databricks.MlflowModelTagArgs{
    					Key:   pulumi.String("key1"),
    					Value: pulumi.String("value1"),
    				},
    				&databricks.MlflowModelTagArgs{
    					Key:   pulumi.String("key2"),
    					Value: pulumi.String("value2"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		this, err := databricks.LookupMlflowModel(ctx, &databricks.LookupMlflowModelArgs{
    			Name: "My MLflow Model",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("model", this)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var thisMlflowModel = new Databricks.MlflowModel("this", new()
        {
            Name = "My MLflow Model",
            Description = "My MLflow model description",
            Tags = new[]
            {
                new Databricks.Inputs.MlflowModelTagArgs
                {
                    Key = "key1",
                    Value = "value1",
                },
                new Databricks.Inputs.MlflowModelTagArgs
                {
                    Key = "key2",
                    Value = "value2",
                },
            },
        });
    
        var @this = Databricks.GetMlflowModel.Invoke(new()
        {
            Name = "My MLflow Model",
        });
    
        return new Dictionary<string, object?>
        {
            ["model"] = @this,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.MlflowModel;
    import com.pulumi.databricks.MlflowModelArgs;
    import com.pulumi.databricks.inputs.MlflowModelTagArgs;
    import com.pulumi.databricks.DatabricksFunctions;
    import com.pulumi.databricks.inputs.GetMlflowModelArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var thisMlflowModel = new MlflowModel("thisMlflowModel", MlflowModelArgs.builder()        
                .name("My MLflow Model")
                .description("My MLflow model description")
                .tags(            
                    MlflowModelTagArgs.builder()
                        .key("key1")
                        .value("value1")
                        .build(),
                    MlflowModelTagArgs.builder()
                        .key("key2")
                        .value("value2")
                        .build())
                .build());
    
            final var this = DatabricksFunctions.getMlflowModel(GetMlflowModelArgs.builder()
                .name("My MLflow Model")
                .build());
    
            ctx.export("model", this_);
        }
    }
    
    resources:
      thisMlflowModel:
        type: databricks:MlflowModel
        name: this
        properties:
          name: My MLflow Model
          description: My MLflow model description
          tags:
            - key: key1
              value: value1
            - key: key2
              value: value2
    variables:
      this:
        fn::invoke:
          Function: databricks:getMlflowModel
          Arguments:
            name: My MLflow Model
    outputs:
      model: ${this}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const this = databricks.getMlflowModel({
        name: "My MLflow Model with multiple versions",
    });
    const thisModelServing = new databricks.ModelServing("this", {
        name: "model-serving-endpoint",
        config: {
            servedModels: [{
                name: "model_serving_prod",
                modelName: _this.then(_this => _this.name),
                modelVersion: _this.then(_this => _this.latestVersions?.[0]?.version),
                workloadSize: "Small",
                scaleToZeroEnabled: true,
            }],
        },
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    this = databricks.get_mlflow_model(name="My MLflow Model with multiple versions")
    this_model_serving = databricks.ModelServing("this",
        name="model-serving-endpoint",
        config=databricks.ModelServingConfigArgs(
            served_models=[databricks.ModelServingConfigServedModelArgs(
                name="model_serving_prod",
                model_name=this.name,
                model_version=this.latest_versions[0].version,
                workload_size="Small",
                scale_to_zero_enabled=True,
            )],
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		this, err := databricks.LookupMlflowModel(ctx, &databricks.LookupMlflowModelArgs{
    			Name: "My MLflow Model with multiple versions",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = databricks.NewModelServing(ctx, "this", &databricks.ModelServingArgs{
    			Name: pulumi.String("model-serving-endpoint"),
    			Config: &databricks.ModelServingConfigArgs{
    				ServedModels: databricks.ModelServingConfigServedModelArray{
    					&databricks.ModelServingConfigServedModelArgs{
    						Name:               pulumi.String("model_serving_prod"),
    						ModelName:          pulumi.String(this.Name),
    						ModelVersion:       pulumi.String(this.LatestVersions[0].Version),
    						WorkloadSize:       pulumi.String("Small"),
    						ScaleToZeroEnabled: pulumi.Bool(true),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Databricks = Pulumi.Databricks;
    
    return await Deployment.RunAsync(() => 
    {
        var @this = Databricks.GetMlflowModel.Invoke(new()
        {
            Name = "My MLflow Model with multiple versions",
        });
    
        var thisModelServing = new Databricks.ModelServing("this", new()
        {
            Name = "model-serving-endpoint",
            Config = new Databricks.Inputs.ModelServingConfigArgs
            {
                ServedModels = new[]
                {
                    new Databricks.Inputs.ModelServingConfigServedModelArgs
                    {
                        Name = "model_serving_prod",
                        ModelName = @this.Apply(@this => @this.Apply(getMlflowModelResult => getMlflowModelResult.Name)),
                        ModelVersion = @this.Apply(@this => @this.Apply(getMlflowModelResult => getMlflowModelResult.LatestVersions[0]?.Version)),
                        WorkloadSize = "Small",
                        ScaleToZeroEnabled = true,
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.databricks.DatabricksFunctions;
    import com.pulumi.databricks.inputs.GetMlflowModelArgs;
    import com.pulumi.databricks.ModelServing;
    import com.pulumi.databricks.ModelServingArgs;
    import com.pulumi.databricks.inputs.ModelServingConfigArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var this = DatabricksFunctions.getMlflowModel(GetMlflowModelArgs.builder()
                .name("My MLflow Model with multiple versions")
                .build());
    
            var thisModelServing = new ModelServing("thisModelServing", ModelServingArgs.builder()        
                .name("model-serving-endpoint")
                .config(ModelServingConfigArgs.builder()
                    .servedModels(ModelServingConfigServedModelArgs.builder()
                        .name("model_serving_prod")
                        .modelName(this_.name())
                        .modelVersion(this_.latestVersions()[0].version())
                        .workloadSize("Small")
                        .scaleToZeroEnabled(true)
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      thisModelServing:
        type: databricks:ModelServing
        name: this
        properties:
          name: model-serving-endpoint
          config:
            servedModels:
              - name: model_serving_prod
                modelName: ${this.name}
                modelVersion: ${this.latestVersions[0].version}
                workloadSize: Small
                scaleToZeroEnabled: true
    variables:
      this:
        fn::invoke:
          Function: databricks:getMlflowModel
          Arguments:
            name: My MLflow Model with multiple versions
    

    Using getMlflowModel

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getMlflowModel(args: GetMlflowModelArgs, opts?: InvokeOptions): Promise<GetMlflowModelResult>
    function getMlflowModelOutput(args: GetMlflowModelOutputArgs, opts?: InvokeOptions): Output<GetMlflowModelResult>
    def get_mlflow_model(description: Optional[str] = None,
                         latest_versions: Optional[Sequence[GetMlflowModelLatestVersion]] = None,
                         name: Optional[str] = None,
                         permission_level: Optional[str] = None,
                         tags: Optional[Sequence[GetMlflowModelTag]] = None,
                         user_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetMlflowModelResult
    def get_mlflow_model_output(description: Optional[pulumi.Input[str]] = None,
                         latest_versions: Optional[pulumi.Input[Sequence[pulumi.Input[GetMlflowModelLatestVersionArgs]]]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         permission_level: Optional[pulumi.Input[str]] = None,
                         tags: Optional[pulumi.Input[Sequence[pulumi.Input[GetMlflowModelTagArgs]]]] = None,
                         user_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetMlflowModelResult]
    func LookupMlflowModel(ctx *Context, args *LookupMlflowModelArgs, opts ...InvokeOption) (*LookupMlflowModelResult, error)
    func LookupMlflowModelOutput(ctx *Context, args *LookupMlflowModelOutputArgs, opts ...InvokeOption) LookupMlflowModelResultOutput

    > Note: This function is named LookupMlflowModel in the Go SDK.

    public static class GetMlflowModel 
    {
        public static Task<GetMlflowModelResult> InvokeAsync(GetMlflowModelArgs args, InvokeOptions? opts = null)
        public static Output<GetMlflowModelResult> Invoke(GetMlflowModelInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetMlflowModelResult> getMlflowModel(GetMlflowModelArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: databricks:index/getMlflowModel:getMlflowModel
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the registered model.
    Description string
    User-specified description for the object.
    LatestVersions List<GetMlflowModelLatestVersion>
    Array of model versions, each the latest version for its stage.
    PermissionLevel string
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    Tags List<GetMlflowModelTag>
    Array of tags associated with the model.
    UserId string
    The username of the user that created the object.
    Name string
    Name of the registered model.
    Description string
    User-specified description for the object.
    LatestVersions []GetMlflowModelLatestVersion
    Array of model versions, each the latest version for its stage.
    PermissionLevel string
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    Tags []GetMlflowModelTag
    Array of tags associated with the model.
    UserId string
    The username of the user that created the object.
    name String
    Name of the registered model.
    description String
    User-specified description for the object.
    latestVersions List<GetMlflowModelLatestVersion>
    Array of model versions, each the latest version for its stage.
    permissionLevel String
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags List<GetMlflowModelTag>
    Array of tags associated with the model.
    userId String
    The username of the user that created the object.
    name string
    Name of the registered model.
    description string
    User-specified description for the object.
    latestVersions GetMlflowModelLatestVersion[]
    Array of model versions, each the latest version for its stage.
    permissionLevel string
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags GetMlflowModelTag[]
    Array of tags associated with the model.
    userId string
    The username of the user that created the object.
    name str
    Name of the registered model.
    description str
    User-specified description for the object.
    latest_versions Sequence[GetMlflowModelLatestVersion]
    Array of model versions, each the latest version for its stage.
    permission_level str
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags Sequence[GetMlflowModelTag]
    Array of tags associated with the model.
    user_id str
    The username of the user that created the object.
    name String
    Name of the registered model.
    description String
    User-specified description for the object.
    latestVersions List<Property Map>
    Array of model versions, each the latest version for its stage.
    permissionLevel String
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags List<Property Map>
    Array of tags associated with the model.
    userId String
    The username of the user that created the object.

    getMlflowModel Result

    The following output properties are available:

    Description string
    User-specified description for the object.
    Id string
    Unique identifier for the object.
    LatestVersions List<GetMlflowModelLatestVersion>
    Array of model versions, each the latest version for its stage.
    Name string
    Name of the model.
    PermissionLevel string
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    Tags List<GetMlflowModelTag>
    Array of tags associated with the model.
    UserId string
    The username of the user that created the object.
    Description string
    User-specified description for the object.
    Id string
    Unique identifier for the object.
    LatestVersions []GetMlflowModelLatestVersion
    Array of model versions, each the latest version for its stage.
    Name string
    Name of the model.
    PermissionLevel string
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    Tags []GetMlflowModelTag
    Array of tags associated with the model.
    UserId string
    The username of the user that created the object.
    description String
    User-specified description for the object.
    id String
    Unique identifier for the object.
    latestVersions List<GetMlflowModelLatestVersion>
    Array of model versions, each the latest version for its stage.
    name String
    Name of the model.
    permissionLevel String
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags List<GetMlflowModelTag>
    Array of tags associated with the model.
    userId String
    The username of the user that created the object.
    description string
    User-specified description for the object.
    id string
    Unique identifier for the object.
    latestVersions GetMlflowModelLatestVersion[]
    Array of model versions, each the latest version for its stage.
    name string
    Name of the model.
    permissionLevel string
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags GetMlflowModelTag[]
    Array of tags associated with the model.
    userId string
    The username of the user that created the object.
    description str
    User-specified description for the object.
    id str
    Unique identifier for the object.
    latest_versions Sequence[GetMlflowModelLatestVersion]
    Array of model versions, each the latest version for its stage.
    name str
    Name of the model.
    permission_level str
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags Sequence[GetMlflowModelTag]
    Array of tags associated with the model.
    user_id str
    The username of the user that created the object.
    description String
    User-specified description for the object.
    id String
    Unique identifier for the object.
    latestVersions List<Property Map>
    Array of model versions, each the latest version for its stage.
    name String
    Name of the model.
    permissionLevel String
    Permission level of the requesting user on the object. For what is allowed at each level, see MLflow Model permissions.
    tags List<Property Map>
    Array of tags associated with the model.
    userId String
    The username of the user that created the object.

    Supporting Types

    GetMlflowModelLatestVersion

    CreationTimestamp int
    CurrentStage string
    Description string
    User-specified description for the object.
    LastUpdatedTimestamp int
    Name string
    Name of the registered model.
    RunId string
    RunLink string
    Source string
    Status string
    StatusMessage string
    Tags List<GetMlflowModelLatestVersionTag>
    Array of tags associated with the model.
    UserId string
    The username of the user that created the object.
    Version string
    CreationTimestamp int
    CurrentStage string
    Description string
    User-specified description for the object.
    LastUpdatedTimestamp int
    Name string
    Name of the registered model.
    RunId string
    RunLink string
    Source string
    Status string
    StatusMessage string
    Tags []GetMlflowModelLatestVersionTag
    Array of tags associated with the model.
    UserId string
    The username of the user that created the object.
    Version string
    creationTimestamp Integer
    currentStage String
    description String
    User-specified description for the object.
    lastUpdatedTimestamp Integer
    name String
    Name of the registered model.
    runId String
    runLink String
    source String
    status String
    statusMessage String
    tags List<GetMlflowModelLatestVersionTag>
    Array of tags associated with the model.
    userId String
    The username of the user that created the object.
    version String
    creationTimestamp number
    currentStage string
    description string
    User-specified description for the object.
    lastUpdatedTimestamp number
    name string
    Name of the registered model.
    runId string
    runLink string
    source string
    status string
    statusMessage string
    tags GetMlflowModelLatestVersionTag[]
    Array of tags associated with the model.
    userId string
    The username of the user that created the object.
    version string
    creation_timestamp int
    current_stage str
    description str
    User-specified description for the object.
    last_updated_timestamp int
    name str
    Name of the registered model.
    run_id str
    run_link str
    source str
    status str
    status_message str
    tags Sequence[GetMlflowModelLatestVersionTag]
    Array of tags associated with the model.
    user_id str
    The username of the user that created the object.
    version str
    creationTimestamp Number
    currentStage String
    description String
    User-specified description for the object.
    lastUpdatedTimestamp Number
    name String
    Name of the registered model.
    runId String
    runLink String
    source String
    status String
    statusMessage String
    tags List<Property Map>
    Array of tags associated with the model.
    userId String
    The username of the user that created the object.
    version String

    GetMlflowModelLatestVersionTag

    Key string
    Value string
    Key string
    Value string
    key String
    value String
    key string
    value string
    key str
    value str
    key String
    value String

    GetMlflowModelTag

    Key string
    Value string
    Key string
    Value string
    key String
    value String
    key string
    value string
    key str
    value str
    key String
    value String

    Package Details

    Repository
    databricks pulumi/pulumi-databricks
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the databricks Terraform Provider.
    databricks logo
    Databricks v1.38.0 published on Monday, Apr 29, 2024 by Pulumi