Skip to content

Add download range to Get-AzureBatchNodeFileContent #4198

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 1 commit into from
Jun 28, 2017

Conversation

matthchr
Copy link
Member

@matthchr matthchr commented Jun 27, 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.

@msftclas
Copy link

@matthchr,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@matthchr
Copy link
Member Author

This is for issue #3863

@matthchr
Copy link
Member Author

I have added a DO NOT MERGE label until one of my colleagues takes a look and signs off, at which point I will remove the label.

Azure PSH folks @cormacpayne @markcowl feel free to review now.

Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(baseRequest =>
{
var fromTaskRequest = baseRequest as BatchRequests.FileGetFromTaskBatchRequest;
if (fromTaskRequest != null && rangeStart != null && rangeEnd != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

So if they specify a start but not an end, or vice versa... does this behave correctly? Finding it a bit hard to track if they get defaulted somewhere along the line, but since they are still nullable at this point I am kind of guessing not...?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it would behave correctly, but maybe should make it clearer that that's the case.

Basically the defaults work such that they can either both be set or neither is set. In the case where neither is set we do what we did before (don't include the range header). In the case where one is set, the other is defaulted (to 0 for start or to long.Max for End)

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.

@matthchr a few minor comments

@@ -21,7 +21,7 @@

## Version 4.1.0
- Added new Get-AzureBatchJobPreparationAndReleaseTaskStatus cmdlet.

- Added byte range start and end to Get-AzureBatchNodeFileContent parameters.
Copy link
Member

Choose a reason for hiding this comment

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

@matthchr this should go under the Current Release header

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

Copy link
Member Author

Choose a reason for hiding this comment

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

And fixed the one above too since they are both in the same release I think, it must've been missed in my previous PR


[Parameter(HelpMessage = "The end of the byte range to be downloaded. If this is not specified and ByteRangeStart is, this defaults to the end of the file.")]
[ValidateNotNullOrEmpty]
public long? ByteRangeEnd { 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.

@matthchr does it make sense to use the ValidateRange attribute for these parameters so you can restrict the values passed through to these parameters? (i.e., negative values cannot be used)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, good idea, I added this

@@ -130,6 +132,32 @@ Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -ByteRangeEnd
The end of the byte range to be downloaded.```yaml
Copy link
Member

Choose a reason for hiding this comment

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

@matthchr platyPS does this weird thing where this ```yaml string is added at the end of the description rather than on the next line by itself, which can cause the markdown to be rendered incorrectly (like it does in this file). Would you mind moving all instances of this ```yaml string to a new line by itself?

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

@matthchr matthchr force-pushed the feature/download-ranges branch from 42a6cc9 to f7ff48f Compare June 27, 2017 16:56
@matthchr
Copy link
Member Author

@itowlson I clarified that it's not possible for one of the ranges to be null while the other isn't in the function signature.

I also added a //TODO to move to use the new way of doing this once we upgrade our C# SDK version here.

@matthchr matthchr force-pushed the feature/download-ranges branch from f7ff48f to da33891 Compare June 27, 2017 17:03
itowlson
itowlson previously approved these changes Jun 27, 2017

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetBatchNodeFileByteRange()
Copy link
Contributor

Choose a reason for hiding this comment

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

Test name should reflect the Fact that it claims to be true.

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 (it's a Theory now though)

cmdlet.InputObject = null;
cmdlet.DestinationPath = null;
cmdlet.ByteRangeStart = 7;
cmdlet.ByteRangeEnd = 14;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there tests for the 'only one end set' case?

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

@matthchr
Copy link
Member Author

@cormacpayne @shahabhijeet - I think I have responded to all comments from my team and you as well. Please feel free to merge at this point provided things look good

@shahabhijeet
Copy link
Contributor

@matthchr
Copy link
Member Author

@cormacpayne Can you give this another look and merge if it looks good to you?

@cormacpayne cormacpayne merged commit fe5a16a into Azure:preview Jun 28, 2017
@matthchr matthchr deleted the feature/download-ranges branch September 28, 2017 01:57
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.

6 participants