Skip to content

Contributing to the repository

Alexander Slotte edited this page Oct 2, 2020 · 7 revisions

Getting started

Prerequisites

  • .NET Core SDK v3.1+
  • Visual Studio or Visual Studio Code

Automated tests

The MLOps.NET solution is automatically tested with unit and integration tests. The integration tests may require specific setup as they will hit the native implementation. Further instructions on how to run them in particular is described below.

To run the automated test suite, build the solution, open the Test explorer and select to run all tests.

General

MLOps.NET uses a private Docker registry running in a container to test against. To start this image, execute the following command:

docker run -d -p 5000:5000 --name registry registry:2

Azure Integration Tests

To run the Azure integration tests you'll need a Docker container running an instance of Azurite.

docker run -p 10000:10000 -p 10001:10001 mcr.microsoft.com/azure-storage/azurite

  • Run the integration tests

SQL Server Integration Tests

To run the SQL Server integration tests you'll need either a local installation of SQL Server or a Docker container running an instance. The recommended approach is to spin up an SQL Server Docker using the following steps:

docker pull mcr.microsoft.com/mssql/server:2019-CU4-ubuntu-16.04

  • Start a container

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=MLOps4TheWin!' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-CU4-ubuntu-16.04

  • Run the integration tests

AWS Integration Tests

To run the AWS (S3 bucket integration test) you'll need to pull down an start a container image of an S3 bucket emulator.

  • Install Docker Desktop

  • Open a command prompt and run docker run -p 9090:9090 -p 9191:9191 -t adobe/s3mock

  • Run the integration tests

Migrations

MLOps.NET utilizes EF Core under the surface to connect to various storage providers, e.g. SQL Server, SQLite and Cosmos Db. For the relational storage providers, we need to create migrations for any changes that are done to the underlying model. Each relational storage provider has its own DbContext, e.g. MLOpsSQLDbContext in MLOps.NET.SQLServer which specifies any provider specific entity configuration by passing in their specific OnModelCreating func. Each storage provider requires its own set of migrations, although they are nearly unique, which is why you'll see a Migrations folder in both MLOps.NET.SQLServer as well as in MLOps.NET.SQLite.

Before adding a migration, ensure that the following agnostic steps are completed.

  • Complete any model changes to one or more entities, e.g. add a new property or relationship
  • Ensure that their respective IEntityConfigurations have been updated (can be found in the MLOps.NET project under Storage -> EntityMaps)
  • If adding a new entity/table, update CosmosEntityConfigurator.cs to map to a container and RelationalEntityConfigurator.cs to map to a table

SQL Server

  • Set the start-up project to MLOps.NET.SQLServer
  • Open the Package-Manager console in Visual Studio
  • Set the default project to MLOps.NET.SQLServer
  • Execute the following command Add-Migration NameOfMigrationHere
  • Since we require XML comments for public members, you'll have some build errors. Either suppress them or add a dummy comment

SQLite

  • Set the start-up project to MLOps.NET.SQLite
  • Open the Package-Manager console in Visual Studio
  • Set the default project to MLOps.NET.SQLite
  • Execute the following command Add-Migration NameOfMigrationHere
  • Since we require XML comments for public members, you'll have some build errors. Either suppress them or add a dummy comment