Skip to content

Commit a4e362d

Browse files
authored
[ML][Schedule] Fix schedule default experiment name (Azure#28917)
* Fix schedule default experiment name Signed-off-by: Brynn Yin <biyi@microsoft.com> * Update test recording * Fix test Signed-off-by: Brynn Yin <biyi@microsoft.com> --------- Signed-off-by: Brynn Yin <biyi@microsoft.com>
1 parent 1fa2a03 commit a4e362d

File tree

8 files changed

+47
-42
lines changed

8 files changed

+47
-42
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Fix experiment name wrongly set to 'Default' when schedule existing job.
12+
1113
### Other Changes
1214

1315
- Added dependency on `azure-mgmt-resource`

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_schedule/schedule.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class JobSchedule(YamlTranslatableMixin, SchemaValidatableMixin, RestTranslatabl
3737
:type name: str
3838
:param trigger: Trigger of the schedule.
3939
:type trigger: Union[CronTrigger, RecurrenceTrigger]
40-
:param create_job: The schedule action job definition.
41-
:type create_job: Job
40+
:param create_job: The schedule action job definition, or the existing job name.
41+
:type create_job: Union[Job, str]
4242
:param display_name: Display name of the schedule.
4343
:type display_name: str
4444
:param description: Description of the schedule, defaults to None
@@ -54,7 +54,7 @@ def __init__(
5454
*,
5555
name: str,
5656
trigger: Union[CronTrigger, RecurrenceTrigger],
57-
create_job: Job,
57+
create_job: Union[Job, str],
5858
display_name: Optional[str] = None,
5959
description: Optional[str] = None,
6060
tags: Optional[Dict] = None,
@@ -267,7 +267,9 @@ def _to_rest_object(self) -> RestSchedule:
267267
# job_definition.source_job_id = self.create_job.id
268268
elif isinstance(self.create_job, str): # arm id reference
269269
# TODO: Update this after source job id move to JobBaseProperties
270-
job_definition = RestPipelineJob(source_job_id=self.create_job)
270+
# Rest pipeline job will hold a 'Default' as experiment_name,
271+
# MFE will add default if None, so pass an empty string here.
272+
job_definition = RestPipelineJob(source_job_id=self.create_job, experiment_name="")
271273
else:
272274
msg = "Unsupported job type '{}' in schedule {}."
273275
raise ValidationException(

sdk/ml/azure-ai-ml/tests/dsl/e2etests/test_controlflow_pipeline.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ def test_pipeline_component_control_output() -> ControlOutputGroup:
204204

205205
registered_pipeline_component = client.components.create_or_update(test_pipeline_component_control_output)
206206
rest_dict = registered_pipeline_component._to_dict()
207-
# Update expected dict, early_available will be removed for subgraph output.
208-
expected_dict["bool_param_output"] = {"type": "boolean", "is_control": True}
209207
assert rest_dict["outputs"] == expected_dict
210208

211209
def test_do_while_combined_if_else(self, client: MLClient):

sdk/ml/azure-ai-ml/tests/recordings/dsl/e2etests/test_controlflow_pipeline.pyTestIfElsetest_registered_component_is_control.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@
902902
},
903903
"bool_param_output": {
904904
"type": "boolean",
905-
"is_control": "True"
905+
"is_control": "True",
906+
"early_available": "True"
906907
},
907908
"int_param_output": {
908909
"type": "integer",

sdk/ml/azure-ai-ml/tests/recordings/schedule/e2etests/test_schedule.pyTestScheduletest_load_cron_schedule_with_arm_id.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
"provisioningErrors": null,
203203
"isAttachedCompute": false,
204204
"properties": {
205-
"vmSize": "STANDARD_DS2_V2",
205+
"vmSize": "STANDARD_DS3_V2",
206206
"vmPriority": "Dedicated",
207207
"scaleSettings": {
208208
"maxNodeCount": 4,
@@ -223,7 +223,7 @@
223223
"allocationState": "Steady",
224224
"allocationStateTransitionTime": "2023-02-21T21:51:31.798\u002B00:00",
225225
"errors": null,
226-
"remoteLoginPortPublicAccess": "Enabled",
226+
"remoteLoginPortPublicAccess": "Disabled",
227227
"osType": "Linux",
228228
"virtualMachineImage": null,
229229
"isolatedNetwork": false,
@@ -284,7 +284,7 @@
284284
"provisioningErrors": null,
285285
"isAttachedCompute": false,
286286
"properties": {
287-
"vmSize": "STANDARD_DS2_V2",
287+
"vmSize": "STANDARD_DS3_V2",
288288
"vmPriority": "Dedicated",
289289
"scaleSettings": {
290290
"maxNodeCount": 4,
@@ -305,7 +305,7 @@
305305
"allocationState": "Steady",
306306
"allocationStateTransitionTime": "2023-02-21T21:51:31.798\u002B00:00",
307307
"errors": null,
308-
"remoteLoginPortPublicAccess": "Enabled",
308+
"remoteLoginPortPublicAccess": "Disabled",
309309
"osType": "Linux",
310310
"virtualMachineImage": null,
311311
"isolatedNetwork": false,
@@ -366,7 +366,7 @@
366366
"provisioningErrors": null,
367367
"isAttachedCompute": false,
368368
"properties": {
369-
"vmSize": "STANDARD_DS2_V2",
369+
"vmSize": "STANDARD_DS3_V2",
370370
"vmPriority": "Dedicated",
371371
"scaleSettings": {
372372
"maxNodeCount": 4,
@@ -387,7 +387,7 @@
387387
"allocationState": "Steady",
388388
"allocationStateTransitionTime": "2023-02-21T21:51:31.798\u002B00:00",
389389
"errors": null,
390-
"remoteLoginPortPublicAccess": "Enabled",
390+
"remoteLoginPortPublicAccess": "Disabled",
391391
"osType": "Linux",
392392
"virtualMachineImage": null,
393393
"isolatedNetwork": false,
@@ -698,7 +698,7 @@
698698
"x-ms-meta-upload_status": "completed",
699699
"x-ms-meta-version": "1",
700700
"x-ms-server-encrypted": "true",
701-
"x-ms-version": "2021-08-06"
701+
"x-ms-version": "2021-06-08"
702702
},
703703
"ResponseBody": null
704704
},
@@ -724,7 +724,7 @@
724724
"Transfer-Encoding": "chunked",
725725
"Vary": "Origin",
726726
"x-ms-error-code": "BlobNotFound",
727-
"x-ms-version": "2021-08-06"
727+
"x-ms-version": "2021-06-08"
728728
},
729729
"ResponseBody": null
730730
},
@@ -1267,7 +1267,7 @@
12671267
"Accept": "application/json",
12681268
"Accept-Encoding": "gzip, deflate",
12691269
"Connection": "keep-alive",
1270-
"Content-Length": "519",
1270+
"Content-Length": "512",
12711271
"Content-Type": "application/json",
12721272
"User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.10.6 (Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)"
12731273
},
@@ -1279,7 +1279,7 @@
12791279
"action": {
12801280
"actionType": "CreateJob",
12811281
"jobDefinition": {
1282-
"experimentName": "Default",
1282+
"experimentName": "",
12831283
"isArchived": false,
12841284
"jobType": "Pipeline",
12851285
"sourceJobId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/test_782110198079"
@@ -1297,7 +1297,7 @@
12971297
"ResponseHeaders": {
12981298
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/mfeOperationsStatus/s:3bd2018e-4b43-401e-ad49-85df181c9e0a:vFPYZfAKLIUZe2A_I4kms4cZhl_15MQWW1R5GJMc2U0?api-version=2022-10-01-preview",
12991299
"Cache-Control": "no-cache",
1300-
"Content-Length": "1086",
1300+
"Content-Length": "1079",
13011301
"Content-Type": "application/json; charset=utf-8",
13021302
"Date": "Tue, 21 Feb 2023 22:06:47 GMT",
13031303
"Expires": "-1",
@@ -1337,7 +1337,7 @@
13371337
"properties": null,
13381338
"displayName": null,
13391339
"status": "NotStarted",
1340-
"experimentName": "Default",
1340+
"experimentName": "",
13411341
"services": null,
13421342
"computeId": null,
13431343
"isArchived": false,
@@ -1494,7 +1494,7 @@
14941494
"properties": null,
14951495
"displayName": null,
14961496
"status": "NotStarted",
1497-
"experimentName": "Default",
1497+
"experimentName": "",
14981498
"services": null,
14991499
"computeId": null,
15001500
"isArchived": false,
@@ -1577,7 +1577,7 @@
15771577
"properties": null,
15781578
"displayName": null,
15791579
"status": "NotStarted",
1580-
"experimentName": "Default",
1580+
"experimentName": "",
15811581
"services": null,
15821582
"computeId": null,
15831583
"isArchived": false,
@@ -1610,7 +1610,7 @@
16101610
"Accept": "application/json",
16111611
"Accept-Encoding": "gzip, deflate",
16121612
"Connection": "keep-alive",
1613-
"Content-Length": "695",
1613+
"Content-Length": "688",
16141614
"Content-Type": "application/json",
16151615
"User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.10.6 (Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)"
16161616
},
@@ -1624,7 +1624,7 @@
16241624
"jobDefinition": {
16251625
"properties": {},
16261626
"tags": {},
1627-
"experimentName": "Default",
1627+
"experimentName": "",
16281628
"isArchived": false,
16291629
"jobType": "Pipeline",
16301630
"inputs": {},
@@ -1650,7 +1650,7 @@
16501650
"ResponseHeaders": {
16511651
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/mfeOperationsStatus/s:3bd2018e-4b43-401e-ad49-85df181c9e0a:7Y1CMDu7zVnaa3GUdA5bhAXdzpTupp2PncN0QEU4wrM?api-version=2022-10-01-preview",
16521652
"Cache-Control": "no-cache",
1653-
"Content-Length": "1145",
1653+
"Content-Length": "1138",
16541654
"Content-Type": "application/json; charset=utf-8",
16551655
"Date": "Tue, 21 Feb 2023 22:06:54 GMT",
16561656
"Expires": "-1",
@@ -1690,7 +1690,7 @@
16901690
"properties": {},
16911691
"displayName": null,
16921692
"status": "NotStarted",
1693-
"experimentName": "Default",
1693+
"experimentName": "",
16941694
"services": null,
16951695
"computeId": null,
16961696
"isArchived": false,

sdk/ml/azure-ai-ml/tests/recordings/schedule/e2etests/test_schedule.pyTestScheduletest_load_cron_schedule_with_arm_id_and_updates.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"provisioningErrors": null,
5353
"isAttachedCompute": false,
5454
"properties": {
55-
"vmSize": "STANDARD_DS2_V2",
55+
"vmSize": "STANDARD_DS3_V2",
5656
"vmPriority": "Dedicated",
5757
"scaleSettings": {
5858
"maxNodeCount": 4,
@@ -73,7 +73,7 @@
7373
"allocationState": "Steady",
7474
"allocationStateTransitionTime": "2023-02-23T08:38:47.225\u002B00:00",
7575
"errors": null,
76-
"remoteLoginPortPublicAccess": "Enabled",
76+
"remoteLoginPortPublicAccess": "Disabled",
7777
"osType": "Linux",
7878
"virtualMachineImage": null,
7979
"isolatedNetwork": false,
@@ -218,7 +218,7 @@
218218
"x-ms-meta-upload_status": "completed",
219219
"x-ms-meta-version": "1",
220220
"x-ms-server-encrypted": "true",
221-
"x-ms-version": "2021-08-06"
221+
"x-ms-version": "2021-06-08"
222222
},
223223
"ResponseBody": null
224224
},
@@ -307,7 +307,7 @@
307307
"Transfer-Encoding": "chunked",
308308
"Vary": "Origin",
309309
"x-ms-error-code": "BlobNotFound",
310-
"x-ms-version": "2021-08-06"
310+
"x-ms-version": "2021-06-08"
311311
},
312312
"ResponseBody": null
313313
},
@@ -524,7 +524,7 @@
524524
"x-ms-meta-upload_status": "completed",
525525
"x-ms-meta-version": "1",
526526
"x-ms-server-encrypted": "true",
527-
"x-ms-version": "2021-08-06"
527+
"x-ms-version": "2021-06-08"
528528
},
529529
"ResponseBody": null
530530
},
@@ -576,7 +576,7 @@
576576
"Transfer-Encoding": "chunked",
577577
"Vary": "Origin",
578578
"x-ms-error-code": "BlobNotFound",
579-
"x-ms-version": "2021-08-06"
579+
"x-ms-version": "2021-06-08"
580580
},
581581
"ResponseBody": null
582582
},
@@ -1264,7 +1264,7 @@
12641264
"Accept": "application/json",
12651265
"Accept-Encoding": "gzip, deflate",
12661266
"Connection": "keep-alive",
1267-
"Content-Length": "469",
1267+
"Content-Length": "462",
12681268
"Content-Type": "application/json",
12691269
"User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.10.6 (Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)"
12701270
},
@@ -1275,7 +1275,7 @@
12751275
"action": {
12761276
"actionType": "CreateJob",
12771277
"jobDefinition": {
1278-
"experimentName": "Default",
1278+
"experimentName": "",
12791279
"isArchived": false,
12801280
"jobType": "Pipeline",
12811281
"sourceJobId": "/subscriptions/00000000-0000-0000-0000-000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/jobs/test_616538984476"
@@ -1293,7 +1293,7 @@
12931293
"ResponseHeaders": {
12941294
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/mfeOperationsStatus/s:3bd2018e-4b43-401e-ad49-85df181c9e0a:BJz3NhesjXlsIiZ2NNpyxsSTskXPck8c0QvXDepdm04?api-version=2022-10-01-preview",
12951295
"Cache-Control": "no-cache",
1296-
"Content-Length": "1059",
1296+
"Content-Length": "1052",
12971297
"Content-Type": "application/json; charset=utf-8",
12981298
"Date": "Thu, 23 Feb 2023 08:45:20 GMT",
12991299
"Expires": "-1",
@@ -1333,7 +1333,7 @@
13331333
"properties": null,
13341334
"displayName": null,
13351335
"status": "NotStarted",
1336-
"experimentName": "Default",
1336+
"experimentName": "",
13371337
"services": null,
13381338
"computeId": null,
13391339
"isArchived": false,
@@ -1490,7 +1490,7 @@
14901490
"properties": null,
14911491
"displayName": null,
14921492
"status": "NotStarted",
1493-
"experimentName": "Default",
1493+
"experimentName": "",
14941494
"services": null,
14951495
"computeId": null,
14961496
"isArchived": false,
@@ -1573,7 +1573,7 @@
15731573
"properties": null,
15741574
"displayName": null,
15751575
"status": "NotStarted",
1576-
"experimentName": "Default",
1576+
"experimentName": "",
15771577
"services": null,
15781578
"computeId": null,
15791579
"isArchived": false,
@@ -1606,7 +1606,7 @@
16061606
"Accept": "application/json",
16071607
"Accept-Encoding": "gzip, deflate",
16081608
"Connection": "keep-alive",
1609-
"Content-Length": "609",
1609+
"Content-Length": "602",
16101610
"Content-Type": "application/json",
16111611
"User-Agent": "azure-ai-ml/1.5.0 azsdk-python-mgmt-machinelearningservices/0.1.0 Python/3.10.6 (Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)"
16121612
},
@@ -1619,7 +1619,7 @@
16191619
"jobDefinition": {
16201620
"properties": {},
16211621
"tags": {},
1622-
"experimentName": "Default",
1622+
"experimentName": "",
16231623
"isArchived": false,
16241624
"jobType": "Pipeline",
16251625
"inputs": {},
@@ -1644,7 +1644,7 @@
16441644
"ResponseHeaders": {
16451645
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000/providers/Microsoft.MachineLearningServices/locations/eastus/mfeOperationsStatus/s:3bd2018e-4b43-401e-ad49-85df181c9e0a:Z_f8-VAz8EBkRcEUmqx5asxcuxvhlmonbXtVzo4V-HU?api-version=2022-10-01-preview",
16461646
"Cache-Control": "no-cache",
1647-
"Content-Length": "1101",
1647+
"Content-Length": "1094",
16481648
"Content-Type": "application/json; charset=utf-8",
16491649
"Date": "Thu, 23 Feb 2023 08:45:36 GMT",
16501650
"Expires": "-1",
@@ -1684,7 +1684,7 @@
16841684
"properties": {},
16851685
"displayName": null,
16861686
"status": "NotStarted",
1687-
"experimentName": "Default",
1687+
"experimentName": "",
16881688
"services": null,
16891689
"computeId": null,
16901690
"isArchived": false,

sdk/ml/azure-ai-ml/tests/schedule/e2etests/test_schedule.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def test_load_cron_schedule_with_arm_id(self, client: MLClient, randstr: Callabl
8484
timeout=LROConfigurations.POLLING_TIMEOUT
8585
)
8686
assert rest_schedule.name == schedule.name
87+
# Asset the empty string added by sdk
88+
assert rest_schedule.create_job.experiment_name == ""
8789
client.schedules.begin_disable(schedule.name)
8890
assert rest_schedule.create_job.id is not None
8991
# Set to None to align with yaml as service will fill this

sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_load_cron_schedule_with_job_reference(self):
5555
"action": {
5656
"action_type": "CreateJob",
5757
"job_definition": {
58-
"experiment_name": "Default",
58+
"experiment_name": "",
5959
"is_archived": False,
6060
"job_type": "Pipeline",
6161
"source_job_id": "/subscriptions/d511f82f-71ba-49a4-8233-d7be8a3650f4/resourceGroups/RLTesting/providers/Microsoft.MachineLearningServices/workspaces/AnkitWS/jobs/test_617704734544",

0 commit comments

Comments
 (0)