-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
@matthchr, |
This is for issue #3863 |
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) |
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.
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...?
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.
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)
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.
@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. |
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.
@matthchr this should go under the Current Release
header
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.
Fixed
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.
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; } |
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.
@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)
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.
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 |
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.
@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?
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.
Fixed
42a6cc9
to
f7ff48f
Compare
@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. |
f7ff48f
to
da33891
Compare
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
public void GetBatchNodeFileByteRange() |
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.
Test name should reflect the Fact
that it claims to be true.
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.
Fixed (it's a Theory
now though)
cmdlet.InputObject = null; | ||
cmdlet.DestinationPath = null; | ||
cmdlet.ByteRangeStart = 7; | ||
cmdlet.ByteRangeEnd = 14; |
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.
Are there tests for the 'only one end set' case?
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.
Fixed
da33891
to
921ca30
Compare
@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 |
@cormacpayne Can you give this another look and merge if it looks good to you? |
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
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