From f91d78511b35d3029c21de37572c14219eb76dcc Mon Sep 17 00:00:00 2001 From: Suba Date: Mon, 17 May 2021 21:49:11 -0700 Subject: [PATCH] Add schedule api (#14360) * Add Identity to createWorkpace example * change for getTransitivePEUsages * update * prettier code * add another new endpoint * address comments * change for getTransitivePEUsages * update * prettier code * add another new endpoint * address comments * revert change on transitivePE and notebookKeys * revert change on transitivePE and notebookKeys * add new stable version 2021-01-01 * add ListNotebookAccessToken * add primaryUserAssignedIdentity * fix missing properties and apis * fix one more missing property * 202 status for start and stop CI * make resync keys long runnin operation in version Jan2021 * resync keys 204 * update resync keys example * Dont throw 204 for resync * update resync keys * Formatting * revert Jan2021changes and add new version * start apr2021 version for azure ml rp * undo remove new line in jan2021 * use systemData definition in common * removed old files * fix small swagger bugs * run prettier * remove reference to sku * update readme * minimum agentCount should be 0 * add createdOn and ModifiedOn to compute properties * add LoadBalancerType to aks compute * add isNotebookInstanceCompute to virtualMachine * add leafDomainLabel to SslConfiguration * add overwriteExistingDomain to SslConfiguration * add synapseSpark as supported compute-type * update patch compute response to 202 * remove location from example responses * Revert "remove location from example responses" This reverts commit 048bf2551513afae842a9c4fbb5861aeddc6c33a. * MachineLearningCompute_Update should have a 200 response * sys data to use local def due to naming conflicts. * Fix enum casing * Fix operationId PR comment. * Change opId in apr version * remove 20210401 for easy review * only change api version * merge changes for 20210401 version * Add x-ms-discriminator-value for Synapse spark * camelcase loadbalancer properties * add createdOn and Modified on to examples * address AvoidAnonymousTypes error for SynapseSpark * Minor fixes + new property * Remove subscription state. * add schedules api * Add schedule examples * case formatting * Cron example for ci create * Prettier check and model validation * renaming property * Address comments * Give a stop example * Fix time format. Co-authored-by: zhaomuzhi Co-authored-by: Vinay Rajmal Soni Co-authored-by: jopet@microsoft.com Co-authored-by: Josh Peterson <15050193+joshanator@users.noreply.github.com> --- .../ComputeInstanceWithSchedules.json | 73 +++++ .../examples/Compute/updateSchedules.json | 36 +++ .../machineLearningServices.json | 260 ++++++++++++++++++ 3 files changed, 369 insertions(+) create mode 100644 specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json create mode 100644 specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/updateSchedules.json diff --git a/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json b/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json new file mode 100644 index 000000000000..eb954d42090e --- /dev/null +++ b/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json @@ -0,0 +1,73 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "testrg123", + "workspaceName": "workspaces123", + "computeName": "compute123", + "api-version": "2021-03-01-preview", + "parameters": { + "location": "eastus", + "properties": { + "computeType": "ComputeInstance", + "properties": { + "vmSize": "STANDARD_NC6", + "subnet": "test-subnet-resource-id", + "applicationSharingPolicy": "Personal", + "sshSettings": { + "sshPublicAccess": "Disabled" + }, + "computeInstanceAuthorizationType": "personal", + "personalComputeInstanceSettings": { + "assignedUser": { + "objectId": "00000000-0000-0000-0000-000000000000", + "tenantId": "00000000-0000-0000-0000-000000000000" + } + }, + "schedules": { + "computeStartStop": [ + { + "status": "Enabled", + "action": "Stop", + "triggerType": "Cron", + "cron": { + "expression": "0 18 * * *", + "startTime": "2021-04-23T01:30:00", + "timeZone": "Pacific Standard Time" + } + } + ] + } + } + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.MachineLearningServices/workspaces/workspaces123/computes/compute123", + "type": "Microsoft.MachineLearningServices/workspaces/computes", + "name": "compute123", + "location": "eastus", + "properties": { + "computeType": "ComputeInstance", + "provisioningState": "Creating" + } + } + }, + "201": { + "body": { + "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.MachineLearningServices/workspaces/workspaces123/computes/compute123", + "type": "Microsoft.MachineLearningServices/workspaces/computes", + "name": "compute123", + "location": "eastus", + "properties": { + "computeType": "ComputeInstance", + "provisioningState": "Creating" + } + }, + "headers": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/...pathToOperationStatus..." + } + } + } +} diff --git a/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/updateSchedules.json b/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/updateSchedules.json new file mode 100644 index 000000000000..293bec00382c --- /dev/null +++ b/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/examples/Compute/updateSchedules.json @@ -0,0 +1,36 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "testrg123", + "workspaceName": "workspaces123", + "computeName": "compute123", + "api-version": "2021-03-01-preview", + "parameters": { + "computeStartStop": [ + { + "status": "Enabled", + "action": "Start", + "triggerType": "Recurrence", + "recurrence": { + "frequency": "Day", + "interval": 1, + "startTime": "2021-04-23T01:30:00", + "timeZone": "Pacific Standard Time", + "schedule": { + "hours": [ + 18 + ], + "minutes": [ + 30 + ], + "weekDays": null + } + } + } + ] + } + }, + "responses": { + "200": {} + } +} diff --git a/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/machineLearningServices.json b/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/machineLearningServices.json index 1d74bbbb2879..0761b7b2c7cf 100644 --- a/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/machineLearningServices.json +++ b/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2021-03-01-preview/machineLearningServices.json @@ -728,6 +728,9 @@ "Create an ComputeInstance Compute": { "$ref": "./examples/Compute/createOrUpdate/ComputeInstance.json" }, + "Create an ComputeInstance Compute with Schedules": { + "$ref": "./examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json" + }, "Create AKS Compute": { "$ref": "./examples/Compute/createOrUpdate/BasicAKSCompute.json" }, @@ -1169,6 +1172,56 @@ } } }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateSchedules": { + "post": { + "tags": [ + "MachineLearningComputes" + ], + "operationId": "Compute_UpdateSchedules", + "description": "Updates schedules of a compute instance", + "x-ms-examples": { + "Update schedules of ComputeInstance": { + "$ref": "./examples/Compute/updateSchedules.json" + } + }, + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "description": "The object for updating schedules of specified ComputeInstance.", + "schema": { + "$ref": "#/definitions/ComputeSchedules" + } + } + ], + "responses": { + "200": { + "description": "Success." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/ErrorResponse" + } + } + } + } + }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections": { "get": { "tags": [ @@ -3155,6 +3208,10 @@ "description": "The last operation on ComputeInstance.", "$ref": "#/definitions/ComputeInstanceLastOperation", "readOnly": true + }, + "schedules": { + "description": "The list of schedules to be applied on the compute instance.", + "$ref": "#/definitions/ComputeSchedules" } } } @@ -4584,6 +4641,209 @@ } } } + }, + "ComputeStartStopSchedule": { + "type": "object", + "description": "Compute start stop schedule properties", + "properties": { + "id": { + "description": "Schedule id.", + "readOnly": true, + "type": "string" + }, + "provisioningStatus": { + "type": "string", + "enum": [ + "Completed", + "Provisioning", + "Failed" + ], + "x-ms-enum": { + "name": "provisioningStatus", + "modelAsString": true + }, + "readOnly": true, + "description": "The current deployment state of schedule." + }, + "status": { + "$ref": "#/definitions/ScheduleStatus" + }, + "triggerType": { + "$ref": "#/definitions/TriggerType" + }, + "action": { + "$ref": "#/definitions/ComputePowerAction" + }, + "recurrence": { + "$ref": "#/definitions/Recurrence" + }, + "cron": { + "$ref": "#/definitions/Cron" + } + } + }, + "ScheduleStatus": { + "type": "string", + "description": "The schedule status.", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "ScheduleStatus", + "modelAsString": true + } + }, + "ScheduleType": { + "type": "string", + "description": "The schedule type.", + "enum": [ + "ComputeStartStop" + ], + "x-ms-enum": { + "name": "ScheduleType", + "modelAsString": true + } + }, + "ComputePowerAction": { + "type": "string", + "description": "The compute power action.", + "enum": [ + "Start", + "Stop" + ], + "x-ms-enum": { + "name": "ComputePowerAction", + "modelAsString": true + } + }, + "TriggerType": { + "type": "string", + "description": "The schedule trigger type.", + "enum": [ + "Recurrence", + "Cron" + ], + "x-ms-enum": { + "name": "TriggerType", + "modelAsString": true + } + }, + "RecurrenceFrequency": { + "type": "string", + "description": "The recurrence frequency.", + "enum": [ + "NotSpecified", + "Second", + "Minute", + "Hour", + "Day", + "Week", + "Month", + "Year" + ], + "x-ms-enum": { + "name": "RecurrenceFrequency", + "modelAsString": true + } + }, + "RecurrenceSchedule": { + "type": "object", + "description": "The recurrence schedule", + "properties": { + "minutes": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "description": "The minutes." + }, + "hours": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "description": "The hours." + }, + "weekDays": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + "x-ms-enum": { + "name": "DaysOfWeek", + "modelAsString": false + } + }, + "description": "The days of the week." + } + } + }, + "Recurrence": { + "type": "object", + "description": "The workflow trigger recurrence for ComputeStartStop schedule type.", + "properties": { + "frequency": { + "$ref": "#/definitions/RecurrenceFrequency" + }, + "interval": { + "type": "integer", + "format": "int32", + "description": "The interval." + }, + "startTime": { + "type": "string", + "description": "The start time." + }, + "timeZone": { + "type": "string", + "description": "The time zone." + }, + "schedule": { + "$ref": "#/definitions/RecurrenceSchedule" + } + } + }, + "Cron": { + "type": "object", + "description": "The workflow trigger cron for ComputeStartStop schedule type.", + "properties": { + "startTime": { + "type": "string", + "description": "The start time." + }, + "timeZone": { + "type": "string", + "description": "The time zone." + }, + "expression": { + "type": "string", + "description": "The cron expression." + } + } + }, + "ComputeSchedules": { + "type": "object", + "description": "The list of schedules to be applied on the computes", + "properties": { + "computeStartStop": { + "type": "array", + "items": { + "$ref": "#/definitions/ComputeStartStopSchedule" + }, + "description": "The list of compute start stop schedules to be applied." + } + } } } }