Skip to content

Update Batch commandlets to support latest APIs #4762

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 5 commits into from
Nov 3, 2017

Conversation

matthchr
Copy link
Member

@matthchr matthchr commented Oct 10, 2017

Description


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.

@matthchr matthchr requested review from darylmsft and xingwu1 October 10, 2017 20:34
@matthchr matthchr force-pushed the feature/batch-psh-vnext branch 3 times, most recently from f7179d9 to 7438ea7 Compare October 11, 2017 02:59
@matthchr
Copy link
Member Author

matthchr commented Oct 12, 2017

@markcowl @cormacpayne The CI is failing because of this:
D:\workspace\powershell\src\Package\StaticAnalysis.exe D:\workspace\powershell\src\Package\Debug D:\workspace\powershell\src\Package true true failing, which looks to be failing because we made breaking changes.

But we made breaking changes on purpose... so I think we should ignore this failure?

@cormacpayne
Copy link
Member

@matthchr Hey Matt, you can ignore that failure since this is a breaking change release and you are making the changes that customers have been previously notified of. You can go ahead and suppress these changes so they don't fail the build - to do so, you will open the BreakingChangeIssues.csv file from the Build Artifacts of the job (the csv is located in src/Package) and copy the contents of the file (you will need to do this in a text editor - make sure to ignore copying the header). Then you will open the BreakingChangeIssues.csv file in tools/StaticAnalysis/Exceptions and paste the contents you copied to the end (also using a text editor).

Let me know if you have any questions.

@@ -40,13 +42,30 @@ public class NewBatchAccountCommand : BatchCmdletBase
[Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true)]
public string AutoStorageAccountId { get; set; }

[Parameter(Position = 4, Mandatory = false, ValueFromPipelineByPropertyName = true)]
Copy link
Member

Choose a reason for hiding this comment

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

If we don't set position, will it reduce the breaking change for future?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure -- I followed the existing pattern in this cmdlet. @cormacpayne @markcowl can you comment on this?

Copy link
Member

Choose a reason for hiding this comment

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

Think of this like unnamed parameters in a method signature - any positional parameter beyiond 3 tends to be not useful. We suggest that you not have positional parameter with position > 3

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it. I will fix this

@@ -233,11 +272,19 @@ public PSCloudServiceConfiguration CloudServiceConfiguration
}
}

public System.Int32? CurrentDedicated
public System.Int32? CurrentDedicatedComputeNodes
Copy link
Member

Choose a reason for hiding this comment

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

Add mapping to CurrentDedicated and obsolete it.

Copy link
Member Author

@matthchr matthchr Oct 26, 2017

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

As long as this is documented in the upcoming breaking changes document, this is ok.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added docs

@@ -445,15 +501,27 @@ public PSPoolStatistics Statistics
}
}

public System.Int32? TargetDedicated
public System.Int32? TargetDedicatedComputeNodes
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

This is ok, but it needs to be documented in the upcoming breaking changes document,a s noted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added documentation there

@@ -151,28 +153,53 @@ public IList<PSExitCodeMapping> ExitCodes
}
}

public PSExitOptions SchedulingError
public PSExitOptions FileUploadError
Copy link
Member

Choose a reason for hiding this comment

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

mapping and obsolete?

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

@@ -45,7 +45,7 @@ internal PSJobSchedulingError(Microsoft.Azure.Batch.JobSchedulingError omObject)
this.omObject = omObject;
}

public Microsoft.Azure.Batch.Common.SchedulingErrorCategory Category
public Microsoft.Azure.Batch.Common.ErrorCategory Category
Copy link
Member

Choose a reason for hiding this comment

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

Does it count "breaking change"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure -- one of the Powershell team members can comment maybe?

Copy link
Member

Choose a reason for hiding this comment

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

If it has a superset of the properties of the previous type, then it is not a breaking change. Otherwise, it is a breakign change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it has a superset.

@@ -53,11 +53,11 @@ internal PSNodeFile(Microsoft.Azure.Batch.NodeFile omObject)
}
}

public string Name
public string Path
Copy link
Member

Choose a reason for hiding this comment

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

same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

This needs to be specifically documented (with an example) in the upcoming-breaking changes

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -328,15 +367,27 @@ public PSStartTask StartTask
}
}

public System.Int32? TargetDedicated
public System.Int32? TargetDedicatedComputeNodes
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

private PSWindowsConfiguration windowsConfiguration;

public PSVirtualMachineConfiguration(PSImageReference imageReference, string nodeAgentSkuId, PSWindowsConfiguration windowsConfiguration = default(PSWindowsConfiguration))
public PSVirtualMachineConfiguration(PSImageReference imageReference, string nodeAgentSkuId)
Copy link
Member

Choose a reason for hiding this comment

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

since the original constructor isn't obsoleted, should we keep it?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case I don't think so since this is a breaking change release, we should feel free to make this sort of change (even though I missed obsoleting it previously).

/// </summary>
public string NodeFileName { get; set; }
public string Path { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

should we keep the original property since it isn't obsoleted?

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

The change in usage needs to be documented in upcoming-breaking-changes

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually only a type used internally in the cmdlets, it's not part of a cmdlet or return type. It's just used to store information about what request is being performed so we can pass it off to the C# SDK, so I don't think there's anything to really say in upcoming-breaking-changes. It was already covered in the Name -> Path change for the GetNodeFile cmdlet.

@@ -65,7 +65,12 @@ public NewPoolParameters(BatchAccountContext context, string poolId, IEnumerable
/// <summary>
/// The target number of compute nodes to allocate to the pool.
/// </summary>
public int? TargetDedicated { get; set; }
public int? TargetDedicatedComputeNodes { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually only a type used internally in the cmdlets, it's not part of a cmdlet or return type. It's just used to store information about what request is being performed so we can pass it off to the C# SDK, so I don't think there's anything to really say in upcoming-breaking-changes.

/// </summary>
public string NodeFileName { get; private set; }
public string Path { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

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

same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

My intent is to just leave this as is (no obsolete) since this is a breaking change, unless otherwise suggested by one of the powershell maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

Same comment, must document in upcoming-breaking changes

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually only a type used internally in the cmdlets, it's not part of a cmdlet or return type. It's just used to store information about what request is being performed so we can pass it off to the C# SDK, so I don't think there's anything to really say in upcoming-breaking-changes. It was already covered in the Name -> Path change for the GetNodeFile/RemoveBatchNodeFile cmdlets, which was already documented.

xingwu1
xingwu1 previously approved these changes Oct 16, 2017
@cormacpayne
Copy link
Member

@azuresdkci test this please

@matthchr matthchr force-pushed the feature/batch-psh-vnext branch from 666e8a6 to e06645c Compare November 1, 2017 02:44
@matthchr
Copy link
Member Author

matthchr commented Nov 1, 2017

@markcowl - Done, commits should be much cleaner now

no longer have a `SchedulingError` property, they instead have a `FailureInformation` property. `FailureInformation` is returned any time there is a task failure.
This includes all previous scheduling error cases, as well as nonzero task exit codes, and file upload failures from the new output files feature.
# Upcoming Breaking Changes

Copy link
Member

Choose a reason for hiding this comment

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

The changes in the output objects are not covered here. Please include a section on how the corresponding output object changes (*Nodes -> *ComputeNodes) would be handled by scripts that use the old proeprty values

@@ -445,15 +501,27 @@ public PSPoolStatistics Statistics
}
}

public System.Int32? TargetDedicated
public System.Int32? TargetDedicatedComputeNodes
Copy link
Member

Choose a reason for hiding this comment

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

This is ok, but it needs to be documented in the upcoming breaking changes document,a s noted.

<package id="WindowsAzure.Storage" version="6.2.0" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Batch" version="4.2.0" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Copy link
Member

Choose a reason for hiding this comment

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

The common packages are all being resrtored by the resource manager common package. We intentionally removed this to prevent different packages taking dependencies on different versions of common libraries. Please revart, other than the changes to batch sdk versions

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, will fix -- I think I used nuget to update the package dependencies and it probably added them back.

- Renamed `ResizeError` to `ResizeErrors` on `PSCloudPool`, and it is now a collection.
- Renamed the `Name` property on `PSNodeFile` to `Path`.
- Renamed `PSTaskSchedulingError` to `PSTaskFailureInformation`.
- Renamed the `SchedulingError` property on `PSJobPreparationTaskExecutionInformation`, `PSJobReleaseTaskExecutionInformation`, `PSStartTaskInformation`, `PSSubtaskInformation`, and `PSTaskExecutionInformation` to `FailureInformation`.
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any of the changes to secure parameter types here. Please ensure that these are documented

Copy link
Member Author

Choose a reason for hiding this comment

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

They're in the section below on per-cmdlet changes

- `PSMultiInstanceSettings` constructor no longer takes a required `numberOfInstances` parameter, instead it takes a required `coordinationCommandLine` parameter.

The following cmdlets were affected this release:

**New-AzureBatchCertificate**
- Parameter "Password" being replaced in favor of a Secure string
Copy link
Member

Choose a reason for hiding this comment

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

Please add explnantions of the change form 'runelevated' to 'UserIdentity'

Copy link
Member Author

Choose a reason for hiding this comment

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

Done -- I think I've covered this now both as a parameter to exisiting cmdlets as well as on the returned object from Get-AzureBatchTask

@@ -27,17 +27,16 @@ namespace Microsoft.Azure.Commands.Batch.Models
using System.Collections;
using System.Collections.Generic;
using Microsoft.Azure.Batch;


[Obsolete("SchedulingError will be removed in a future version and replaced with FailureInformation")]
Copy link
Member

Choose a reason for hiding this comment

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

Need an example of usage of the new type and how this has changed in the upcoming-breakign changes document

Copy link
Member Author

Choose a reason for hiding this comment

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

The type itself is used the same way (it's structured the same, just renamed). I will clarify in upcoming-breaking-changes though.

/// </summary>
public string NodeFileName { get; set; }
public string Path { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

The change in usage needs to be documented in upcoming-breaking-changes

/// </summary>
public string NodeFileName { get; private set; }
public string Path { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

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

Same comment, must document in upcoming-breaking changes

[ValidateNotNullOrEmpty]
public int TargetDedicated { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

needs toi be documented for the migration guide

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

- Renamed `PSTaskSchedulingError` to `PSTaskFailureInformation`.
- Renamed the `SchedulingError` property on `PSJobPreparationTaskExecutionInformation`, `PSJobReleaseTaskExecutionInformation`, `PSStartTaskInformation`, `PSSubtaskInformation`, and `PSTaskExecutionInformation` to `FailureInformation`.
- `FailureInformation` is returned any time there is a task failure. This includes all previous scheduling error cases, as well as nonzero task exit codes, and file upload failures from the new output files feature.
- Renamed the `SchedulingError` property on `PSExitConditions` to `PreProcessingError`.
Copy link
Member

Choose a reason for hiding this comment

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

Have noted some places where additional documentation appears to be necessary. Essentially any breaking change in parameter or output type properties need to be documented here with an example. This will be sued to create the migration guide.

@matthchr matthchr force-pushed the feature/batch-psh-vnext branch 2 times, most recently from 8f8ea9f to 5ea9226 Compare November 1, 2017 22:46
@matthchr
Copy link
Member Author

matthchr commented Nov 1, 2017

@markcowl - Updated according to your feedback. Breaking change doc clarified, moved to all per-cmdlet style.

Please let me know ASAP if there's anything else we need to do, or if we're good to merge.

markcowl
markcowl previously approved these changes Nov 2, 2017
@cormacpayne
Copy link
Member

@markcowl
Copy link
Member

markcowl commented Nov 2, 2017

@matthchr the on-demand run is failing due to the plural parameter names - you will need to add suppressions to the SignatureIssues.xml file in toold\StaticAnalysis to match.

@matthchr
Copy link
Member Author

matthchr commented Nov 2, 2017

@markcowl - There is no such file in tools\StaticAnalysis

Where should I add the suppressions, and how do I know what the format of the supressions is...?
edit: Mark helped me find the supressions log (it's .csv not .xml)

  - Add support for Azure Batch SDK 8.0.
    - Includes one new cmdlet (Get-AzureBatchTaskCounts) and a number of cmdlet updates.
  - Re-record tests.
  - Regenerate help text.
  - Use secure string for password fields.
@matthchr matthchr force-pushed the feature/batch-psh-vnext branch from 54cc3a9 to 64f67d8 Compare November 2, 2017 18:00
@markcowl
Copy link
Member

markcowl commented Nov 2, 2017

@markcowl
Copy link
Member

markcowl commented Nov 2, 2017

@markcowl markcowl changed the base branch from preview to release-5.0.0 November 2, 2017 23:24
@markcowl markcowl merged commit 3477556 into Azure:release-5.0.0 Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants