Details and queue management

This commit is contained in:
2017-01-06 08:43:22 -05:00
parent d14e40a36b
commit 42ac27e16f
24 changed files with 260 additions and 51 deletions
+6 -1
View File
@@ -17,7 +17,7 @@ namespace LeafWeb.WebCms.Services
private readonly string _emailFromAddress;
private const string EmailSuccessSubject = "LeafWeb Results";
private const string EmailSuccessSubject = "LeafWeb results";
private const string EmailErrorSubject = "LeafWeb processing error";
private const string EmailSystemErrorSubject = "LeafWeb system error";
@@ -58,6 +58,11 @@ namespace LeafWeb.WebCms.Services
public void SendLeafWebComplete(int leafInputId)
{
var leafInput = _dataService.GetLeafInput(leafInputId);
if (leafInput.CurrentStatus != LeafInputStatusType.Complete)
{
Logger.Error($"Attempting to SendLeafWebComplete when status is not complete for leafInput: {leafInput}, current status: {leafInput.CurrentStatus}");
throw new ArgumentException($"Attempting to SendLeafWebComplete when status is not complete for leafInput: {leafInput}, current status: {leafInput.CurrentStatus}");
}
var outputErrorMessage = leafInput.OutputErrorMessage;
if (outputErrorMessage != null)
@@ -83,15 +83,15 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
Logger.InfoFormat("LeafInput: {0}, Starting", pendingInputId);
try
{
DataService.SetLeafInputStatus(pendingInput, LeafInputStatusType.Starting,
details: $"File count: {pendingInput.InputFiles.Count}");
DataService.SetLeafInputStatus(pendingInput, LeafInputStatusType.Starting, "Copying input to Piscal",
$"File count: {pendingInput.InputFiles.Count}");
BackgroundJobEnqueueRetry<StartPending>(c => c.DoWork(pendingInputId));
}
catch (Exception ex)
{
var errorMessage = FormatException(ex);
Logger.Error(errorMessage);
DataService.SetLeafInputStatus(pendingInput, LeafInputStatusType.Exception, ex.Message, errorMessage);
DataService.SetLeafInputStatus(pendingInput, LeafInputStatusType.Exception, "Exception while StartPending", errorMessage);
}
}
@@ -108,8 +108,9 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
{
case PiscalStatus.NotStarted:
// if it's not started - this is unusual state
PiscalWarningHandler($"LeafInput: {leafInput.Id}, Piscal reporting Not Started, setting to pending to retry", leafInput);
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Pending);
var pendingToRetry = "Piscal reporting Not Started, setting to Pending to retry";
PiscalWarningHandler($"LeafInput: {leafInput.Id}, {pendingToRetry}", leafInput);
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Pending, details: pendingToRetry);
break;
case PiscalStatus.Running:
@@ -118,7 +119,7 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
break;
case PiscalStatus.Complete:
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Finishing);
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Finishing, "Copying output from Piscal");
BackgroundJobEnqueueRetry<FinishComplete>(s => s.DoWork(leafInputId));
break;
+1 -1
View File
@@ -10,7 +10,7 @@ namespace LeafWeb.WebCms.Services.PiscalQueue
PiscalService.Run(leafInput);
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Running, details: $"ServiceInfo: {PiscalService.ServiceDescription}");
DataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Running, "Starting Piscal", $"{PiscalService.ServiceDescription}");
}
}
}