-
Notifications
You must be signed in to change notification settings - Fork 361
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
Helix SDK Avoids Upload for Disabled Queues #4011
Conversation
Fix for issue 3892: #3892 |
Right now, I'm trying to determine what the exact objectives are for what the PR should achieve. |
8b38066
to
d727a3e
Compare
@@ -125,6 +126,11 @@ public class SendHelixJob : HelixTask | |||
/// </summary> | |||
public int MaxRetryCount { get; set; } | |||
|
|||
/// <summary> | |||
/// <see langword="true"/> when a warning will be thrown when a queue is disabled,; <see langword="false"/> (default value) when an error will be thrown. |
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.
Poor readability, please reword.
Suggestion: "When True, issue a warning when a queue is unavailable; when False, issue an error to fail the build"
@@ -149,6 +155,22 @@ protected override async Task ExecuteCore(CancellationToken cancellationToken) | |||
{ | |||
var currentHelixApi = HelixApi; | |||
|
|||
Client.Models.QueueInfo qi = await currentHelixApi.Information.QueueInfoAsync(TargetQueue); | |||
bool? availability = qi.IsAvailable; |
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.
Can definitely combine lines 159 and 160
/// <summary> | ||
/// <see langword="true"/> when a warning will be thrown when a queue is disabled,; <see langword="false"/> (default value) when an error will be thrown. | ||
/// </summary> | ||
public bool ProceedIfQueueDisabled { get; set; } = false; |
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.
In neither cases do we proceed. Can this be named something that indicates what it does, e.g. `ErrorOnUnavailableQueues" or something?
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.
To clarify, is the behavior when it only throws a warning that (after skipping uploading to the current queue) it continues with whatever it was doing?
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.
no you return from the task (which I agree with). That's my objection to the term "proceed"
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.
Functionally seems like the right fix, please clean up the property naming and comments.
@@ -149,6 +155,22 @@ protected override async Task ExecuteCore(CancellationToken cancellationToken) | |||
{ | |||
var currentHelixApi = HelixApi; | |||
|
|||
Client.Models.QueueInfo qi = await currentHelixApi.Information.QueueInfoAsync(TargetQueue); |
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 Client.Models isn't necessary, just add the appropriate using.
@@ -55,7 +56,8 @@ | |||
PostCommands="$(HelixPostCommands)" | |||
CorrelationPayloads="@(HelixCorrelationPayload)" | |||
WorkItems="@(HelixWorkItem)" | |||
HelixProperties="@(HelixProperties)"> | |||
HelixProperties="@(HelixProperties)" | |||
ProceedIfQueueDisabled="$(ProceedIfDisabled)"> |
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.
Fix formatting please
tests/UnitTests.proj
Outdated
@@ -73,6 +73,7 @@ | |||
<HelixTargetQueue Include="Debian.9.Amd64.Open"/> | |||
<HelixTargetQueue Include="RedHat.7.Amd64.Open"/> | |||
<HelixTargetQueue Include="Windows.10.Amd64.Open"/> | |||
<HelixTargetQueue Include="Alpine.36.Amd64"/> |
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.
Can't have this here if you ever want your build to be green
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.
Perhaps I could leave it commented-out, with another comment describing what it does?
tests/UnitTests.proj
Outdated
@@ -12,7 +12,7 @@ | |||
<IncludeDotNetCli>true</IncludeDotNetCli> | |||
<DotNetCliPackageType>sdk</DotNetCliPackageType> | |||
|
|||
<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter> | |||
<EnableAzurePipelinesReporter>false</EnableAzurePipelinesReporter> |
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.
?
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 don't remember if this change was made for debugging purposes. I suppose I should revert it?
59d49aa
to
5139188
Compare
@@ -23,7 +23,7 @@ namespace Microsoft.Cci.Extensions.CSharp | |||
public static class CSharpCciExtensions |
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 file somehow got added back in after I removed it (it was originally added when I resolved a merge conflict the wrong way).
337d1e9
to
ecbd195
Compare
/// </summary> | ||
public bool ProceedIfQueueDisabled { get; set; } = false; | ||
public bool NoErrorIfQueueDisabled { get; set; } = false; |
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.
sorry to be so nitpicky. This variable is a boolean. The No or Yes of Error If queue is disabled is covered by the true/falseness of the variable.
It makes a lot more sense for Error to be false versus NoError to be False meaning error.
e7ec214
to
8a0d34d
Compare
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.
LGTM, consider the one little bit of cleanup but not blocking.
{ | ||
if (LogErrorIfQueueDisabled) | ||
{ | ||
Log.LogError("Queue is not available"); |
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.
nit: Doesn't hurt to log the queue name here, e.g. Log.LogError($"Queue '{TargetQueue}' is not available");"
This reverts commit 663f5c6.
This fix detects if a specified target queue has IsAvailable = false, and if so, does not upload, and logs either an error or a warning (depending on whether ProceedIfQueueDisabled is true, or the default false)