-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Machine Learning Compute: Add -IncludeAllResources Paramter for Remove cmdlet #5206
Conversation
@maddieclayton I've started this PR so that you can take a look at the code changes while I'm waiting for the .NET SDK PR to be completed and the new package to be created. Once that's done I'll remove the local nuget package I added and make sure the build works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few initial comments. Please let me know when the SDK changes have been merged and the PR is updated. Also, please be sure to resolve the merge conflict that has come up.
var clusterToDelete = MachineLearningComputeManagementClient.OperationalizationClusters.Get(ResourceGroupName, Name); | ||
var managedByResourceGroup = new ResourceIdentifier(clusterToDelete.ContainerRegistry.ResourceId).ResourceGroupName; | ||
|
||
shouldProcessMessage += $" and supporting resource group {managedByResourceGroup}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the supporting resource group the only additional resource that will be deleted when -IncludeAllResources is specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it deletes that cluster and the supporting resource group only. The supporting resource group has a bunch of resources in it, I could change it to list them all out but it will include things like network security groups, nics, vms, disks, etc. It seemed too verbose to list all those resources individually so I think just warning that that resource group will be deleted should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I agree that this message would make the most sense. Maybe it would be useful to also add in the message that all resources in the supporting resource group will be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion.
</Reference> | ||
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these three references: they are already imported by the common dependencies target.
@@ -1,4 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<packages> | |||
<package id="Microsoft.Azure.Management.MachineLearningCompute" version="0.2.0" targetFramework="net452" /> | |||
<package id="Microsoft.Azure.Management.MachineLearningCompute" version="0.3.0" targetFramework="net452" /> | |||
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about removing the three duplicate references.
Remove-AzureRmMlOpCluster -ResourceGroupName $resourceGroupName -Name $clusterName -IncludeAllResources | ||
|
||
Assert-Throws ( Get-AzureRmResourceGroup -ResourceGroupName $managedByResourceGroupName ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this throw? Shouldn't it complete the operation successfully and delete both the managed resource group and the cluster? And if it is supposed to throw, I would think you'd want another test with the command running successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws because after a successful remove call with -IncludeAllResources the resource group I'm trying to get should not exist. So by expecting the throw I can verify that the -IncludeAllResources worked correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense - I did not expect that a Get would throw when the resource is not found, but if that is the behavior then this test makes sense. Thanks.
@shutchings I'll take a look once the merge conflict has been resolved - please feel free to assign the PR back to me once this is done and you are ready for me to take a look. |
@maddieclayton I fixed the merge conflict and removed the local package since I got the latest one published to nuget. From the looks of it it's failing static analysis and should regen the installer. Is that correct? |
@shutchings The issue is that the parameter you added is plural (which is okay since it is a SwitchParameter). Please copy the message (the issue with severity 1) from SignatureIssues.csv (found in the build) in breakingchanges.csv. This should resolve the issue, please let me know if you have any more questions. |
@maddieclayton I added in the exception but it is still failing. The other issues were severity 2 so I assume they aren't failing the build. Is there something else missing? |
@shutchings No, the issue is still the plural parameter name. Can you try following the format of the lines above Microsoft.Azure.Commands.Compute:
It looks like the format you used only works for compute for reason - if this does not fix the issue I'll look into it further. |
@maddieclayton I think I have it in the right format now but it's still giving issues. |
@shutchings Oh no, this is my fault. It should go in tool/Exception/SignatureIssues.csv, not breakingchanges. I apologize for the confusion, but that should work. Don't use the new format that you switched to, just copy paste again into the csv file. |
@maddieclayton Yep, that did it! |
@shutchings Great! If you are ready for another review please assign the PR back to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two very small comments then looks good to me.
* Add IncludeAllResources parameter to Remove-AzureRmMlOpCluster cmdlet | ||
- Using this switch parameter will remove all resources that were created with the cluster originally | ||
|
||
## Version 0.3.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't modify this - just add your snippet after the snippets about ResourceGroup and Location completers. We will automatically modify this file during release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I looked at the version number in the .psd1 file and it shows 0.3.1 which is below the current release so that's why I thought the version numbers are off. But maybe I'm misunderstanding? Is it that the bullets below current release are slated for the next version to be released?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Current release" actually means the upcoming release: it will be displayed as the current release notes in the next release.
@@ -58,26 +58,47 @@ public class RemoveAzureRmMlOpCluster : MachineLearningComputeCmdletBase | |||
HelpMessage = ResourceIdParameterHelpMessage)] | |||
public string ResourceId { get; set; } | |||
|
|||
[Parameter(ParameterSetName = ObjectParameterSet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the parameter is in all of the parameter sets you don't need a parameter attribute for each parameter set, all you need is:
[Parameter(Mandatory = false, HelpMessage = IncludeAllResourcesParameterHelpMessage)]
public SwitchParameter IncludeAllResources { get; set; }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know!
@maddieclayton Is it possible to start a package job? |
Yup, here is it:https://azuresdkci.westus2.cloudapp.azure.com/view/PowerShell/job/posh-pack/42/. Let me know when you are ready to merge. |
@shutchings is this ready to merge? I wasn't sure if you were running testing on the package job or needed it for another reason. |
@maddieclayton I found a typo in the parameter name in the help document while testing the package job. Must have been from when I regenerated the help and then made changes to the parameter name. After this build feel free to merge it. |
Description
Added a parameter to include all resources when removing an operationalization cluster.
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines