implementd AsBooleanStrict and check in JobRunner
This commit is contained in:
Родитель
1a311dad2b
Коммит
a1c0c67889
|
@ -334,6 +334,25 @@ namespace Microsoft.VisualStudio.Services.Agent.Worker
|
|||
return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Failed);
|
||||
}
|
||||
|
||||
// check if knob DrainQueuesAfterTask has correct value
|
||||
bool defaultDrainQueuesAfterTask = AgentKnobs.DrainQueuesAfterTask.GetValue<BuiltInDefaultKnobSource>(jobContext).AsBoolean();
|
||||
try
|
||||
{
|
||||
AgentKnobs.DrainQueuesAfterTask.GetValue(jobContext).AsBooleanStrict();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
switch (ex)
|
||||
{
|
||||
case ArgumentException _:
|
||||
case FormatException _:
|
||||
jobContext.Warning($"Knob 'AGENT_DRAIN_QUEUES_AFTER_TASK' has wrong value, default value '{defaultDrainQueuesAfterTask}' will be set");
|
||||
break;
|
||||
default:
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// trace out all steps
|
||||
Trace.Info($"Total job steps: {jobSteps.Count}.");
|
||||
Trace.Verbose($"Job steps: '{string.Join(", ", jobSteps.Select(x => x.DisplayName))}'");
|
||||
|
|
|
@ -310,7 +310,14 @@ namespace Microsoft.VisualStudio.Services.Agent.Worker
|
|||
step.ExecutionContext.Section(StringUtil.Loc("StepFinishing", step.DisplayName));
|
||||
step.ExecutionContext.Complete();
|
||||
|
||||
if (AgentKnobs.DrainQueuesAfterTask.GetValue(step.ExecutionContext).AsBoolean() == true)
|
||||
bool drainQueuesAfterTask = AgentKnobs.DrainQueuesAfterTask.GetValue<BuiltInDefaultKnobSource>(step.ExecutionContext).AsBoolean();
|
||||
try
|
||||
{
|
||||
drainQueuesAfterTask = AgentKnobs.DrainQueuesAfterTask.GetValue(step.ExecutionContext).AsBooleanStrict();
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (drainQueuesAfterTask == true)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче