Skip to content

Commit

Permalink
Handle warnings, log them, and return as success
Browse files Browse the repository at this point in the history
  • Loading branch information
boverhof committed Aug 30, 2018
1 parent cb67c03 commit 00f2cef
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions Master/Turbine.Consumer.SimSinter/SinterConsumerRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,13 @@ private void DoInitialize(IJobConsumerContract job, sinter.ISimulation stest, JO
Debug.WriteLine(String.Format("Warm-up complete and successful. Reseting Sim for real run {0}", job.Id),
"SinterConsumer.Run");
}
else if (stest.runStatus == sinter.sinter_AppError.si_SIMULATION_WARNING)
{
stest.recvOutputsFromSim();
job.Message("Warm-up with warnings. Reseting Sim for real run.");
Debug.WriteLine(String.Format("Warm-up with warnings. Reseting Sim for real run {0}", job.Id),
"SinterConsumer.Run");
}
else
{
job.Message("Warm-up complete and failed. Reseting Sim for real run.");
Expand Down Expand Up @@ -711,15 +718,22 @@ protected void DoRun(IJobConsumerContract job, sinter.ISimulation stest, JObject
{
stest.recvOutputsFromSim();
job.Message("Real Run was complete and successful.");
Debug.WriteLine(String.Format("Real Run was complete and successful. Job Id: {0} ", job.Id),
Debug.WriteLine(String.Format("Real Run was complete and successful. Job Id: {0}", job.Id),
"SinterConsumer.Run");
}
else
else if (stest.runStatus == sinter.sinter_AppError.si_SIMULATION_WARNING)
{
job.Message("Real Run was complete and failed.");
Debug.WriteLine(String.Format("Real Run was complete and failed. Job Id: {0}", job.Id),
stest.recvOutputsFromSim();
job.Message("Real Run was completed with warning.");
Debug.WriteLine(String.Format("Real Run was completed with warning. Job Id: {0}", job.Id),
"SinterConsumer.Run");
}
else
{
job.Message(String.Format("Real Run failed, runStatus={0}", stest.runStatus));
Debug.WriteLine(String.Format("Real Run was complete and failed. Job Id: {0}, runStatus={1}",
job.Id, stest.runStatus), "SinterConsumer.Run");
}
}
running = false;
if (isTerminated)
Expand Down Expand Up @@ -791,7 +805,8 @@ protected virtual void DoFinalize(sinter.ISimulation stest,
JObject outputDict;
try
{
if (stest.runStatus == sinter.sinter_AppError.si_OKAY)
if (stest.runStatus == sinter.sinter_AppError.si_OKAY ||
stest.runStatus == sinter.sinter_AppError.si_SIMULATION_WARNING)
{
var superDict = stest.getOutputs();
outputDict = (JObject)superDict["outputs"];
Expand All @@ -801,7 +816,8 @@ protected virtual void DoFinalize(sinter.ISimulation stest,
}
else
{
Debug.WriteLine("Sinter runstatus is not si_OKAY to retrieve outputs.", "SinterConsumer.DoFinalize");
Debug.WriteLine(String.Format("Sinter runstatus={0}, did not retrieve outputs.", stest.runStatus),
"SinterConsumer.DoFinalize");
}
}
catch (Exception ex)
Expand Down Expand Up @@ -851,10 +867,11 @@ protected virtual void DoFinalize(sinter.ISimulation stest,
//sim.terminate();
}
}
//else if (stest.runStatus == sinter.sinter_AppError.si_SIMULATION_WARNING)
//{
// job.Error(String.Join(",", stest.warningsBasic()));
//}
else if (stest.runStatus == sinter.sinter_AppError.si_SIMULATION_WARNING)
{
job.Message(String.Join(",", stest.warningsBasic()));
job.Success();
}
else if (stest.runStatus == sinter.sinter_AppError.si_COM_EXCEPTION)
{
Debug.WriteLine("Error: si_COM_EXCEPTION", "SinterConsumerRun.DoFinalize");
Expand Down

0 comments on commit 00f2cef

Please sign in to comment.