Added service for model management for machine learning extension (#1138)

* Added service for model management for ml extension
This commit is contained in:
Leila Lali
2021-01-19 11:33:55 -08:00
committed by GitHub
parent f0a5e11d51
commit 01d0f03262
15 changed files with 1725 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class ConfigureModelTableRequestParams : ModelRequestBase
{
}
/// <summary>
/// Response class for get model
/// </summary>
public class ConfigureModelTableResponseParams : ModelResponseBase
{
}
/// <summary>
/// Request class to get models
/// </summary>
public class ConfigureModelTableRequest
{
public static readonly
RequestType<ConfigureModelTableRequestParams, ConfigureModelTableResponseParams> Type =
RequestType<ConfigureModelTableRequestParams, ConfigureModelTableResponseParams>.Create("models/configure");
}
}

View File

@@ -0,0 +1,34 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class DeleteModelRequestParams : ModelRequestBase
{
/// <summary>
/// Model id
/// </summary>
public int ModelId { get; set; }
}
/// <summary>
/// Response class for delete model
/// </summary>
public class DeleteModelResponseParams : ModelResponseBase
{
}
/// <summary>
/// Request class to delete a model
/// </summary>
public class DeleteModelRequest
{
public static readonly
RequestType<DeleteModelRequestParams, DeleteModelResponseParams> Type =
RequestType<DeleteModelRequestParams, DeleteModelResponseParams>.Create("models/delete");
}
}

View File

@@ -0,0 +1,38 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class DownloadModelRequestParams : ModelRequestBase
{
/// <summary>
/// Model id
/// </summary>
public int ModelId { get; set; }
}
/// <summary>
/// Response class for import model
/// </summary>
public class DownloadModelResponseParams : ModelResponseBase
{
/// <summary>
/// Downloaded file path
/// </summary>
public string FilePath { get; set; }
}
/// <summary>
/// Request class to delete a model
/// </summary>
public class DownloadModelRequest
{
public static readonly
RequestType<DownloadModelRequestParams, DownloadModelResponseParams> Type =
RequestType<DownloadModelRequestParams, DownloadModelResponseParams>.Create("models/download");
}
}

View File

@@ -0,0 +1,32 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using System.Collections.Generic;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class GetModelsRequestParams : ModelRequestBase
{
}
/// <summary>
/// Response class for get model
/// </summary>
public class GetModelsResponseParams : ModelResponseBase
{
public List<ModelMetadata> Models { get; set; }
}
/// <summary>
/// Request class to get models
/// </summary>
public class GetModelsRequest
{
public static readonly
RequestType<GetModelsRequestParams, GetModelsResponseParams> Type =
RequestType<GetModelsRequestParams, GetModelsResponseParams>.Create("models/get");
}
}

View File

@@ -0,0 +1,34 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class ImportModelRequestParams : ModelRequestBase
{
/// <summary>
/// Model metadata
/// </summary>
public ModelMetadata Model { get; set; }
}
/// <summary>
/// Response class for import model
/// </summary>
public class ImportModelResponseParams : ModelResponseBase
{
}
/// <summary>
/// Request class to import a model
/// </summary>
public class ImportModelRequest
{
public static readonly
RequestType<ImportModelRequestParams, ImportModelResponseParams> Type =
RequestType<ImportModelRequestParams, ImportModelResponseParams>.Create("models/import");
}
}

View File

@@ -0,0 +1,75 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement
{
/// <summary>
/// Model metadata
/// </summary>
public class ModelMetadata
{
/// <summary>
/// Model id
/// </summary>
public int Id { get; set; }
/// <summary>
/// Model content length
/// </summary>
public Int64 ContentLength { get; set; }
/// <summary>
/// Model name
/// </summary>
public string ModelName { get; set; }
/// <summary>
/// Model created date
/// </summary>
public string Created { get; set; }
/// <summary>
/// Model deployment time
/// </summary>
public string DeploymentTime { get; set; }
/// <summary>
/// Model version
/// </summary>
public string Version { get; set; }
/// <summary>
/// Model description
/// </summary>
public string Description { get; set; }
/// <summary>
/// Model file path
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// Model framework
/// </summary>
public string Framework { get; set; }
/// <summary>
/// Model framework version
/// </summary>
public string FrameworkVersion { get; set; }
/// <summary>
/// Model run id
/// </summary>
public string RunId { get; set; }
/// <summary>
/// Model deploy by
/// </summary>
public string DeployedBy { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class ModelRequestBase
{
/// <summary>
/// Models database name
/// </summary>
public string DatabaseName { get; set; }
/// <summary>
/// The schema for model table
/// </summary>
public string SchemaName { get; set; }
/// <summary>
/// Models table name
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Connection uri
/// </summary>
public string OwnerUri { get; set; }
}
public class ModelResponseBase
{
}
}

View File

@@ -0,0 +1,30 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class UpdateModelRequestParams : ImportModelRequestParams
{
}
/// <summary>
/// Response class for import model
/// </summary>
public class UpdateModelResponseParams : ModelResponseBase
{
}
/// <summary>
/// Request class to import a model
/// </summary>
public class UpdateModelRequest
{
public static readonly
RequestType<UpdateModelRequestParams, UpdateModelResponseParams> Type =
RequestType<UpdateModelRequestParams, UpdateModelResponseParams>.Create("models/update");
}
}

View File

@@ -0,0 +1,35 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using System.Collections.Generic;
namespace Microsoft.SqlTools.ServiceLayer.ModelManagement.Contracts
{
public class VerifyModelTableRequestParams : ModelRequestBase
{
}
/// <summary>
/// Response class for verify model table
/// </summary>
public class VerifyModelTableResponseParams : ModelResponseBase
{
/// <summary>
/// Specified is model table is verified
/// </summary>
public bool Verified { get; set; }
}
/// <summary>
/// Request class to verify model table
/// </summary>
public class VerifyModelTableRequest
{
public static readonly
RequestType<VerifyModelTableRequestParams, VerifyModelTableResponseParams> Type =
RequestType<VerifyModelTableRequestParams, VerifyModelTableResponseParams>.Create("models/verify");
}
}