コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the WebServicePropertiesForGraph
 /// class.
 /// </summary>
 public WebServicePropertiesForGraph(string title = default(string), string description = default(string), DateTime?createdOn = default(DateTime?), DateTime?modifiedOn = default(DateTime?), string provisioningState = default(string), WebServiceKeys keys = default(WebServiceKeys), bool?readOnlyProperty = default(bool?), string swaggerLocation = default(string), bool?exposeSampleData = default(bool?), RealtimeConfiguration realtimeConfiguration = default(RealtimeConfiguration), DiagnosticsConfiguration diagnostics = default(DiagnosticsConfiguration), StorageAccount storageAccount = default(StorageAccount), MachineLearningWorkspace machineLearningWorkspace = default(MachineLearningWorkspace), CommitmentPlan commitmentPlan = default(CommitmentPlan), ServiceInputOutputSpecification input = default(ServiceInputOutputSpecification), ServiceInputOutputSpecification output = default(ServiceInputOutputSpecification), ExampleRequest exampleRequest = default(ExampleRequest), IDictionary <string, AssetItem> assets = default(IDictionary <string, AssetItem>), IDictionary <string, string> parameters = default(IDictionary <string, string>), GraphPackage package = default(GraphPackage))
     : base(title, description, createdOn, modifiedOn, provisioningState, keys, readOnlyProperty, swaggerLocation, exposeSampleData, realtimeConfiguration, diagnostics, storageAccount, machineLearningWorkspace, commitmentPlan, input, output, exampleRequest, assets, parameters)
 {
     Package = package;
 }
コード例 #2
0
ファイル: WebServiceTests.cs プロジェクト: QITIE/ADLSTool
        private static WebService GetServiceDefinitionFromTestData(string testDataFile, string commitmentPlanId, StorageAccount storageAccount)
        {
            string serviceAsJson     = File.ReadAllText(testDataFile);
            var    serviceDefinition = ModelsSerializationUtil.GetAzureMLWebServiceFromJsonDefinition(serviceAsJson);

            serviceDefinition.Location = WebServiceTests.DefaultLocation;
            serviceDefinition.Properties.CommitmentPlan.Id = commitmentPlanId;
            serviceDefinition.Properties.StorageAccount    = storageAccount;
            return(serviceDefinition);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the WebServiceProperties class.
 /// </summary>
 /// <param name="title">The title of the web service.</param>
 /// <param name="description">The description of the web
 /// service.</param>
 /// <param name="createdOn">Read Only: The date and time when the web
 /// service was created.</param>
 /// <param name="modifiedOn">Read Only: The date and time when the web
 /// service was last modified.</param>
 /// <param name="provisioningState">Read Only: The provision state of
 /// the web service. Valid values are Unknown, Provisioning, Succeeded,
 /// and Failed. Possible values include: 'Unknown', 'Provisioning',
 /// 'Succeeded', 'Failed'</param>
 /// <param name="keys">Contains the web service provisioning keys. If
 /// you do not specify provisioning keys, the Azure Machine Learning
 /// system generates them for you. Note: The keys are not returned from
 /// calls to GET operations.</param>
 /// <param name="readOnlyProperty">When set to true, indicates that the
 /// web service is read-only and can no longer be updated or patched,
 /// only removed. Default, is false. Note: Once set to true, you cannot
 /// change its value.</param>
 /// <param name="swaggerLocation">Read Only: Contains the URI of the
 /// swagger spec associated with this web service.</param>
 /// <param name="exposeSampleData">When set to true, sample data is
 /// included in the web service's swagger definition. The default value
 /// is true.</param>
 /// <param name="realtimeConfiguration">Contains the configuration
 /// settings for the web service endpoint.</param>
 /// <param name="diagnostics">Settings controlling the diagnostics
 /// traces collection for the web service.</param>
 /// <param name="storageAccount">Specifies the storage account that
 /// Azure Machine Learning uses to store information about the web
 /// service. Only the name of the storage account is returned from
 /// calls to GET operations. When updating the storage account
 /// information, you must ensure that all necessary assets are
 /// available in the new storage account or calls to your web service
 /// will fail.</param>
 /// <param name="machineLearningWorkspace">Specifies the Machine
 /// Learning workspace containing the experiment that is source for the
 /// web service.</param>
 /// <param name="commitmentPlan">Contains the commitment plan
 /// associated with this web service. Set at creation time. Once set,
 /// this value cannot be changed. Note: The commitment plan is not
 /// returned from calls to GET operations.</param>
 /// <param name="input">Contains the Swagger 2.0 schema describing one
 /// or more of the web service's inputs. For more information, see the
 /// Swagger specification.</param>
 /// <param name="output">Contains the Swagger 2.0 schema describing one
 /// or more of the web service's outputs. For more information, see the
 /// Swagger specification.</param>
 /// <param name="exampleRequest">Defines sample input data for one or
 /// more of the service's inputs.</param>
 /// <param name="assets">Contains user defined properties describing
 /// web service assets. Properties are expressed as Key/Value
 /// pairs.</param>
 /// <param name="parameters">The set of global parameters values
 /// defined for the web service, given as a global parameter name to
 /// default value map. If no default value is specified, the parameter
 /// is considered to be required.</param>
 /// <param name="payloadsInBlobStorage">When set to true, indicates
 /// that the payload size is larger than 3 MB. Otherwise false. If the
 /// payload size exceed 3 MB, the payload is stored in a blob and the
 /// PayloadsLocation parameter contains the URI of the blob. Otherwise,
 /// this will be set to false and Assets, Input, Output, Package,
 /// Parameters, ExampleRequest are inline. The Payload sizes is
 /// determined by adding the size of the Assets, Input, Output,
 /// Package, Parameters, and the ExampleRequest.</param>
 /// <param name="payloadsLocation">The URI of the payload blob. This
 /// paramater contains a value only if the payloadsInBlobStorage
 /// parameter is set to true. Otherwise is set to null.</param>
 public WebServiceProperties(string title = default(string), string description = default(string), System.DateTime?createdOn = default(System.DateTime?), System.DateTime?modifiedOn = default(System.DateTime?), string provisioningState = default(string), WebServiceKeys keys = default(WebServiceKeys), bool?readOnlyProperty = default(bool?), string swaggerLocation = default(string), bool?exposeSampleData = default(bool?), RealtimeConfiguration realtimeConfiguration = default(RealtimeConfiguration), DiagnosticsConfiguration diagnostics = default(DiagnosticsConfiguration), StorageAccount storageAccount = default(StorageAccount), MachineLearningWorkspace machineLearningWorkspace = default(MachineLearningWorkspace), CommitmentPlan commitmentPlan = default(CommitmentPlan), ServiceInputOutputSpecification input = default(ServiceInputOutputSpecification), ServiceInputOutputSpecification output = default(ServiceInputOutputSpecification), ExampleRequest exampleRequest = default(ExampleRequest), IDictionary <string, AssetItem> assets = default(IDictionary <string, AssetItem>), IDictionary <string, WebServiceParameter> parameters = default(IDictionary <string, WebServiceParameter>), bool?payloadsInBlobStorage = default(bool?), BlobLocation payloadsLocation = default(BlobLocation))
 {
     Title             = title;
     Description       = description;
     CreatedOn         = createdOn;
     ModifiedOn        = modifiedOn;
     ProvisioningState = provisioningState;
     Keys                     = keys;
     ReadOnlyProperty         = readOnlyProperty;
     SwaggerLocation          = swaggerLocation;
     ExposeSampleData         = exposeSampleData;
     RealtimeConfiguration    = realtimeConfiguration;
     Diagnostics              = diagnostics;
     StorageAccount           = storageAccount;
     MachineLearningWorkspace = machineLearningWorkspace;
     CommitmentPlan           = commitmentPlan;
     Input                    = input;
     Output                   = output;
     ExampleRequest           = exampleRequest;
     Assets                   = assets;
     Parameters               = parameters;
     PayloadsInBlobStorage    = payloadsInBlobStorage;
     PayloadsLocation         = payloadsLocation;
     CustomInit();
 }
コード例 #4
0
ファイル: WebServiceTests.cs プロジェクト: QITIE/ADLSTool
        private void RunAMLWebServiceTestScenario(AMLWebServiceTestDelegate actualTest,
                                                  [System.Runtime.CompilerServices.CallerMemberName]
                                                  string methodName = "testframework_failed")
        {
            using (var context = MockContext.Start(this.GetType().FullName, methodName))
            {
                bool   testIsSuccessfull = true;
                string cpRpApiVersion    = string.Empty;
                ResourceManagementClient resourcesClient         = null;
                StorageManagementClient  storageManagementClient = null;

                var amlServiceName     = TestUtilities.GenerateName(WebServiceTests.TestServiceNamePrefix);
                var resourceGroupName  = TestUtilities.GenerateName(WebServiceTests.TestResourceGroupNamePrefix);
                var commitmentPlanName = TestUtilities.GenerateName(WebServiceTests.TestCommitmentPlanNamePrefix);
                var cpDeploymentName   = "depl" + commitmentPlanName;
                var storageAccountName = TestUtilities.GenerateName(WebServiceTests.TestStorageAccountPrefix);

                try
                {
                    // Create a resource group for the AML service
                    resourcesClient = context.GetServiceClient <ResourceManagementClient>();
                    var resourceGroupDefinition = new ResourceGroup
                    {
                        Location = WebServiceTests.DefaultLocation
                    };
                    resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName, resourceGroupDefinition);

                    // Create a support storage account for the service in this resource group
                    storageManagementClient = context.GetServiceClient <StorageManagementClient>();
                    var accountParameters = new StorageAccountCreateParameters
                    {
                        AccountType = AccountType.StandardLRS,
                        Location    = WebServiceTests.DefaultLocation
                    };
                    storageManagementClient.StorageAccounts.Create(resourceGroupName, storageAccountName, accountParameters);
                    StorageAccountKeys accountKeys = storageManagementClient.StorageAccounts.ListKeys(resourceGroupName, storageAccountName);
                    var storageAccountInfo         = new StorageAccount(storageAccountName, accountKeys.Key1);

                    // Create an AML commitment plan resource to associate with the services
                    cpRpApiVersion = ResourceProvidersHelper.GetRPApiVersion(resourcesClient, WebServiceTests.MLResourceProviderNamespace, WebServiceTests.CPResourceType);
                    var cpDeploymentItems = WebServiceTests.CreateCommitmentPlanResource(resourceGroupName, commitmentPlanName, cpDeploymentName, resourcesClient, cpRpApiVersion);
                    var cpResource        = cpDeploymentItems.Item2;

                    // Create a client for the AML RP and run the actual test
                    var webServicesClient = context.GetServiceClient <AzureMLWebServicesManagementClient>();
                    webServicesClient.LongRunningOperationRetryTimeout = WebServiceTests.AsyncOperationPollingIntervalSeconds;

                    // Run the actual test
                    actualTest(amlServiceName, resourceGroupName, resourcesClient, webServicesClient, cpResource.Id, storageAccountInfo);
                }
                catch (CloudException cloudEx)
                {
                    Trace.TraceError("Caught unexpected exception: ");
                    Trace.TraceError(WebServiceTests.GenerateCloudExceptionReport(cloudEx));
                    testIsSuccessfull = false;
                }
                finally
                {
                    if (resourcesClient != null)
                    {
                        // Delete the deployment with the commitment plan
                        if (cpRpApiVersion != string.Empty)
                        {
                            WebServiceTests.DisposeOfTestResource(() => resourcesClient.Resources.Delete(resourceGroupName, WebServiceTests.MLResourceProviderNamespace, string.Empty, WebServiceTests.CPResourceType, commitmentPlanName, cpRpApiVersion));
                            WebServiceTests.DisposeOfTestResource(() => resourcesClient.Deployments.Delete(resourceGroupName, cpDeploymentName));
                        }

                        // Delete the created storage account
                        WebServiceTests.DisposeOfTestResource(() => storageManagementClient.StorageAccounts.Delete(resourceGroupName, storageAccountName));

                        // Delete the created resource group
                        WebServiceTests.DisposeOfTestResource(() => resourcesClient.ResourceGroups.Delete(resourceGroupName));
                    }
                }
                Assert.True(testIsSuccessfull);
            }
        }