コード例 #1
0
        public void UseAzureStorage_ConfiguresManager()
        {
            IMLOpsContext lcManager = new MLOpsBuilder().UseAzureStorage("UseDevelopmentStorage=true").Build();

            lcManager.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");
            var metaDataField   = typeof(MLOpsContext).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);
            var repositoryField = typeof(MLOpsContext).GetField("modelRepository", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataField.GetValue(lcManager).Should().BeOfType <StorageAccountMetaDataStore>();
            repositoryField.GetValue(lcManager).Should().BeOfType <StorageAccountModelRepository>();
        }
コード例 #2
0
        public void UseAzureStorage_ConfiguresManager()
        {
            var           sqlitePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}{Path.DirectorySeparatorChar}.mlops";
            IMLOpsContext lcManager  = new MLOpsBuilder().UseSQLite(sqlitePath).Build();

            lcManager.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");
            var metaDataField   = typeof(MLOpsContext).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);
            var repositoryField = typeof(MLOpsContext).GetField("modelRepository", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataField.GetValue(lcManager).Should().BeOfType <SQLiteMetaDataStore>();
            repositoryField.GetValue(lcManager).Should().BeOfType <LocalFileModelRepository>();
        }
コード例 #3
0
        public void UseSQLServer_ConfiguresLifeCycleCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder()
                                          .UseSQLServer(this.configuration[ConfigurationKeys.ConnectionString])
                                          .UseModelRepository(new Mock <IModelRepository>().Object)
                                          .Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.LifeCycle.Should().NotBeNull();
        }
コード例 #4
0
        public void UseSqlLite_ConfiguresLifeCycleCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder()
                                          .UseSQLite()
                                          .UseModelRepository(new Mock <IModelRepository>().Object)
                                          .Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.LifeCycle.Should().NotBeNull();
        }
コード例 #5
0
        public void UseAzureStorage_ConfiguresModelCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder().UseAzureStorage("UseDevelopmentStorage=true").Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.Model.Should().NotBeNull();

            var repositoryField = typeof(ModelCatalog).GetField("modelRepository", BindingFlags.Instance | BindingFlags.NonPublic);

            repositoryField.GetValue(unitUnderTest.Model).Should().BeOfType <StorageAccountModelRepository>();
        }
コード例 #6
0
        public void UseAzureStorage_ConfiguresLifeCycleCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder().UseAzureStorage("UseDevelopmentStorage=true").Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.LifeCycle.Should().NotBeNull();

            var metaDataField = typeof(LifeCycleCatalog).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataField.GetValue(unitUnderTest.LifeCycle).Should().BeOfType <StorageAccountMetaDataStore>();
        }
コード例 #7
0
        public void UseAzureStorage_ConfiguresModelCatalog()
        {
            //Act
            var           sqlitePath    = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}{Path.DirectorySeparatorChar}.mlops";
            IMLOpsContext unitUnderTest = new MLOpsBuilder().UseSQLite(sqlitePath).Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.Model.Should().NotBeNull();

            var repositoryField = typeof(ModelCatalog).GetField("modelRepository", BindingFlags.Instance | BindingFlags.NonPublic);

            repositoryField.GetValue(unitUnderTest.Model).Should().BeOfType <LocalFileModelRepository>();
        }
コード例 #8
0
        public void UseAzureStorage_ConfiguresEvaluationCatalog()
        {
            //Act
            var           sqlitePath    = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}{Path.DirectorySeparatorChar}.mlops";
            IMLOpsContext unitUnderTest = new MLOpsBuilder().UseSQLite(sqlitePath).Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.Evaluation.Should().NotBeNull();

            var metaDataField = typeof(EvaluationCatalog).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataField.GetValue(unitUnderTest.Evaluation).Should().BeOfType <SQLiteMetaDataStore>();
        }
コード例 #9
0
        public void MLOpsBuilder_BuildCreatesConfiguredLifeCycleManager()
        {
            var           metaDataStore = new Mock <IMetaDataStore>().Object;
            var           repository    = new Mock <IModelRepository>().Object;
            IMLOpsContext lcManager     = new MLOpsBuilder()
                                          .UseMetaDataStore(metaDataStore)
                                          .UseModelRepository(repository)
                                          .Build();

            lcManager.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");
            var metaDataField   = typeof(MLOpsContext).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);
            var repositoryField = typeof(MLOpsContext).GetField("modelRepository", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataStore.Should().BeSameAs(metaDataField.GetValue(lcManager), "Because UseMetaDataStore should set the IMetaDataStore instance via constructor");
            repository.Should().BeSameAs(repositoryField.GetValue(lcManager), "Because UseModelRepository should set the IModelRepository instance via constructor");
        }
コード例 #10
0
        public void UseAWSS3ModelRepository_ConfiguresModelCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder()
                                          .UseAWSS3ModelRepository("access-key-id", "secret-access-key", "region-name")
                                          .UseMetaDataRepositories(new Mock <IDbContextFactory>().Object)
                                          .Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLOpsContext is MLOpsContext");

            //Assert
            unitUnderTest.Model.Should().NotBeNull();

            var repositoryField = typeof(ModelCatalog).GetField("modelRepository", BindingFlags.Instance | BindingFlags.NonPublic);

            repositoryField.GetValue(unitUnderTest.Model).Should().BeOfType <S3BucketModelRepository>();
        }
コード例 #11
0
        public void UseSQLServer_ConfiguresLifeCycleCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder()
                                          .UseSQLServer("connectionString")
                                          .UseModelRepository(new Mock <IModelRepository>().Object)
                                          .Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.LifeCycle.Should().NotBeNull();

            var metaDataField = typeof(LifeCycleCatalog).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataField.GetValue(unitUnderTest.LifeCycle).Should().BeOfType <SQLServerMetaDataStore>();
        }
コード例 #12
0
        public void UseSqlLiteStorage_ConfiguresTrainingCatalog()
        {
            //Act
            IMLOpsContext unitUnderTest = new MLOpsBuilder()
                                          .UseSQLite()
                                          .UseModelRepository(new Mock <IModelRepository>().Object)
                                          .Build();

            unitUnderTest.Should().BeOfType <MLOpsContext>("Because the default IMLLifeCycleManager is MLLifeCycleManager");

            //Assert
            unitUnderTest.Training.Should().NotBeNull();

            var metaDataField = typeof(TrainingCatalog).GetField("metaDataStore", BindingFlags.Instance | BindingFlags.NonPublic);

            metaDataField.GetValue(unitUnderTest.Training).Should().BeOfType <SQLiteMetaDataStore>();
        }