Skip to content
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

Merged
merged 3 commits into from
Oct 3, 2019
Merged

Conversation

Tohron
Copy link
Contributor

@Tohron Tohron commented Sep 25, 2019

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)

@dnfclas
Copy link

dnfclas commented Sep 25, 2019

CLA assistant check
All CLA requirements met.

@Tohron
Copy link
Contributor Author

Tohron commented Sep 25, 2019

Fix for issue 3892: #3892

@Tohron Tohron self-assigned this Sep 25, 2019
@Tohron
Copy link
Contributor Author

Tohron commented Sep 26, 2019

Right now, I'm trying to determine what the exact objectives are for what the PR should achieve.

@Tohron Tohron force-pushed the handle_disabled_queues branch from 8b38066 to d727a3e Compare September 30, 2019 23:39
@@ -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.
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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"

Copy link
Member

@MattGal MattGal left a 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);
Copy link
Member

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)">
Copy link
Member

Choose a reason for hiding this comment

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

Fix formatting please

@@ -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"/>
Copy link
Member

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

Copy link
Contributor Author

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?

@@ -12,7 +12,7 @@
<IncludeDotNetCli>true</IncludeDotNetCli>
<DotNetCliPackageType>sdk</DotNetCliPackageType>

<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
<EnableAzurePipelinesReporter>false</EnableAzurePipelinesReporter>
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

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?

@Tohron Tohron force-pushed the handle_disabled_queues branch from 59d49aa to 5139188 Compare October 1, 2019 21:03
@@ -23,7 +23,7 @@ namespace Microsoft.Cci.Extensions.CSharp
public static class CSharpCciExtensions
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 file somehow got added back in after I removed it (it was originally added when I resolved a merge conflict the wrong way).

@Tohron Tohron force-pushed the handle_disabled_queues branch 2 times, most recently from 337d1e9 to ecbd195 Compare October 1, 2019 22:39
/// </summary>
public bool ProceedIfQueueDisabled { get; set; } = false;
public bool NoErrorIfQueueDisabled { get; set; } = false;
Copy link
Member

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.

@Tohron Tohron force-pushed the handle_disabled_queues branch from e7ec214 to 8a0d34d Compare October 3, 2019 18:01
Copy link
Member

@MattGal MattGal left a 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");
Copy link
Member

@MattGal MattGal Oct 3, 2019

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");"

@Tohron Tohron merged commit 663f5c6 into master Oct 3, 2019
ChadNedzlek added a commit to ChadNedzlek/arcade that referenced this pull request Oct 4, 2019
ChadNedzlek added a commit that referenced this pull request Oct 4, 2019
@riarenas riarenas deleted the handle_disabled_queues branch January 28, 2020 19:19
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.

4 participants