Skip to content

Adding Machine Learning Compute cmdlets #4681

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

Merged
merged 7 commits into from
Oct 6, 2017

Conversation

shutchings
Copy link
Contributor

@shutchings shutchings commented Sep 28, 2017

Description

This is an approved PR for the 4.5.0 release. These cmdlet's were supposed to make it in to the 4.4.0 release but didn't quite make it. I've been working closely with @markcowl and @cormacpayne for my reviews and feedback. This was the original PR. A lot of feedback was incorporated into it but @cormacpayne closed it in favor of this PR where he continued to merge some of the recent changes from preview.

The .NET SDK was merged to the public repo in this PR. The nuget package has been published and these cmdlets are not using a local package.


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

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@shutchings
Copy link
Contributor Author

Looks like @cormacpayne and @markcowl are OOF until the end of the week. Is someone stepping in for them?

@azuresdkci
Copy link

Can one of the admins verify this patch?

@cormacpayne
Copy link
Member

@azuresdkci add to whitelist

Copy link
Member

@cormacpayne cormacpayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings a few minor comments.

Unsigned packing job to ensure your module has been included in AzureRM and that your cmdlets appear: http://azuresdkci.cloudapp.net/job/posh-pack/5/

ChangeLog.md Outdated
@@ -1,4 +1,13 @@
## 2017.09.25 - Version 4.4.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings please revert the changes made to this file, we will handle updating the ChangeLog in the root of the repository during the release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings there should be no app.config file for the Commands folder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I think I had it because of some dependency issues but it looks like those got cleaned up in past revisions. Probably from the changes you made.

<Link>AzureRM.MachineLearningCompute.psd1</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="app.config" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings please remove the reference to app.config

@shutchings
Copy link
Contributor Author

@cormacpayne I installed the package and tested the cmdlets and things look good.

@shutchings
Copy link
Contributor Author

@cormacpayne @markcowl Looks like today is when it's supposed to be code complete. Any additional changes?

Copy link
Member

@cormacpayne cormacpayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings a few minor comments that need looking at. Code complete has been moved to Friday, so you have a little bit of time to get these changes in.

<Reference Include="Microsoft.Azure.Management.MachineLearningCompute, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.MachineLearningCompute.0.1.0\lib\net452\Microsoft.Azure.Management.MachineLearningCompute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings Microsoft.Rest.ClientRuntime.* and Newtonsoft.Json are already being imported from Common.Dependencies.targets, so these references are not needed in your csproj.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

namespace Microsoft.Azure.Commands.MachineLearningCompute.Cmdlets
{
[Cmdlet(VerbsCommon.Get, CmdletSuffix + "Key")]
[OutputType(typeof(OperationalizationClusterCredentials))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings can we create a new class that is PSOperationalizationClusterCredentials and return that instead? This will prevent issues with potential breaking changes in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


try
{
WriteObject(MachineLearningComputeManagementClient.OperationalizationClusters.ListKeys(ResourceGroupName, Name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings if this is returning more than one object, make sure to use the WriteObject overload with enumerateCollection:true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method only ever returns one object that wraps up multiple keys.

{
var exceptionDetails = e.Message + ".";

foreach (var err in e.Body.Details)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings is the body ever null for an error? I want to make sure we avoid the scenario where e.Body.Details throws an error because e.Body is null.

Also, would we need to do any null-checking for e.Body.Details?

Copy link
Contributor Author

@shutchings shutchings Oct 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points! I have to do this extra handling for the different types of errors that the SDK returns so that the error message to the user isn't just "Bad Request" or "Not Found". I've settled on trying to unwrap the errors as best as I can but I'll throw the original error if I have issues doing that. That way the user will always still get the original error, or a more descriptive one, and not an error due to the unwrapping.

In my experimentation the body isn't null but the details can be at times. I've added the additional checks.

namespace Microsoft.Azure.Commands.MachineLearningCompute.Cmdlets
{
[Cmdlet(VerbsDiagnostic.Test, CmdletSuffix + "SystemServicesUpdateAvailability")]
[OutputType(typeof(CheckSystemServicesUpdatesAvailableResponse))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings same comment about wrapping this in a PS class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

{

[Cmdlet(VerbsData.Update, CmdletSuffix + "SystemService", SupportsShouldProcess = true)]
[OutputType(typeof(UpdateSystemServicesResponse))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings same comment about wrapping this in a PS class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Management.MachineLearningCompute" version="0.1.0" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shutchings remove same packages outlined in csproj

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@cormacpayne
Copy link
Member

@shutchings
Copy link
Contributor Author

shutchings commented Oct 6, 2017

@cormac The cmdlets in the package job look good.

@cormacpayne cormacpayne merged commit ad4b8f3 into Azure:preview Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants