Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Engine/DataFeeds/Enumerators/SubscriptionFilterEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static SubscriptionFilterEnumerator WrapForDataFeed(IResultHandler result
filter.DataFilterError += (sender, exception) =>
{
Log.Error(exception, "WrapForDataFeed");
resultHandler.RuntimeError("Runtime error applying data filter. Assuming filter pass: " + exception.Message, exception.StackTrace);
resultHandler.ErrorMessage("Runtime error applying data filter. Assuming filter pass: " + exception.Message, exception.StackTrace);
};
return filter;
}
Expand Down Expand Up @@ -192,4 +192,4 @@ private void OnDataFilterError(Exception exception)
if (handler != null) handler(this, exception);
}
}
}
}
1 change: 1 addition & 0 deletions Engine/Results/BaseResultsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ protected void SetAlgorithmState(string error, string stack)
{
State["RuntimeError"] = error;
State["StackTrace"] = stack;
Algorithm?.SetStatus(AlgorithmStatus.RuntimeError);
}

/// <summary>
Expand Down
19 changes: 19 additions & 0 deletions Tests/Engine/Results/BaseResultsHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ public void CheckSaveLogs()
Assert.AreEqual(Path.Combine(tempPath, $"{id}-log.txt"), saveLocation);
}

[Test]
public void SetAlgorithmStateSetsAlgorithmRuntimeErrorStatus()
{
_baseResultsHandler = new BaseResultsHandlerTestable(AlgorithmId);
var algorithm = new QCAlgorithm();
algorithm.SetStatus(AlgorithmStatus.Running);
_baseResultsHandler.SetAlgorithm(algorithm, 100000);

_baseResultsHandler.SetAlgorithmStateForTest("error", "stack");

Assert.AreEqual(AlgorithmStatus.RuntimeError, algorithm.Status);
}

[TestCase(100)]
[TestCase(-100)]
[TestCase(0)]
Expand Down Expand Up @@ -199,6 +212,12 @@ public void SetResultsDestinationFolder(string folder)
ResultsDestinationFolder = folder;
}
public string GetResultsDestinationFolder => ResultsDestinationFolder;

public void SetAlgorithmStateForTest(string error, string stack)
{
SetAlgorithmState(error, stack);
}

protected override void Run()
{
throw new NotImplementedException();
Expand Down