Skip to content

Fix AutoFitMaxExperimentTimeTest #5506

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

Merged
merged 10 commits into from
Dec 1, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Print more info...
  • Loading branch information
antoniovs1029 committed Nov 25, 2020
commit 8eaeb66b0fb7979040d2360120ffb8810a857fe0
19 changes: 18 additions & 1 deletion test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,24 @@ public void AutoFitMaxExperimentTimeTest(int iteration)
// can increase the run time of unit tests, and may not produce multiple runs.
if (experiment.RunDetails.Select(r => r.Exception == null).Count() > 1 && experiment.RunDetails.Last().Exception != null)
{
Assert.True(experiment.RunDetails.Last().Exception.Message.Contains("Operation was canceled"),
var lastException = experiment.RunDetails.Last().Exception;
var containsMessage = lastException.Message.Contains("Operation was canceled");

if(!containsMessage)
{
var isAggregate = lastException is AggregateException;
Console.WriteLine($"Type: {lastException.GetType()} - IsAggregate: {isAggregate} - Exception Message: {lastException.Message}, - InnerException Message: {lastException.InnerException?.Message}");
if(isAggregate)
{
Console.WriteLine("Printing inner exceptions...");
foreach (var ex in ((AggregateException)lastException).Flatten().InnerExceptions)
{
Console.WriteLine($"Exception Message: { ex.Message}, -InnerException Message: { ex.InnerException?.Message}")
}
}
}

Assert.True(lastException.Message.Contains("Operation was canceled"),
"Iteration " + iteration + "Did not obtain 'Operation was canceled' error. Obtained unexpected error: " + experiment.RunDetails.Last().Exception.Message);
// Ensure that the best found model can still run after maximum experiment time was reached.
IDataView predictions = experiment.BestRun.Model.Transform(trainData);
Expand Down