Further testing with partial data runs

This commit is contained in:
2025-01-15 12:35:15 -07:00
parent e37d9757ec
commit 784471c5ce
14 changed files with 107 additions and 57 deletions

View File

@ -68,9 +68,6 @@ internal class Run
return results.AsReadOnly();
}
private static ReadOnlyCollection<string> GetLines(JsonElement jsonElement) =>
GetLines(new JsonElement[] { jsonElement });
private static void WriteTabSeparatedValues(Logistics logistics, List<FileInfo> fileInfoCollection, Run run)
{
List<Row> results = new();
@ -89,10 +86,12 @@ internal class Run
fileInfoCollection.Add(fileInfo);
}
private static void WriteException(Logistics logistics, Exception ex)
private static ReadOnlyCollection<string> GetWaferIds(Header header)
{
FileInfo fileInfo = new($"{logistics.ReportFullPath}.{nameof(Exception)}.txt");
File.WriteAllText(fileInfo.FullName, $"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
List<string> results = new();
foreach (WaferSummary waferSummary in header.WaferSummary)
results.Add(waferSummary.Id);
return results.AsReadOnly();
}
internal static Run? Get(Logistics logistics, List<FileInfo> fileInfoCollection, ReadOnlyDictionary<string, string> pages)
@ -105,35 +104,12 @@ internal class Run
result = null;
else
{
ReadOnlyCollection<Wafer> wafers = Wafer.Get(pages, constant, headerFileName);
if (wafers.Count == 0)
result = null;
else
{
result = new(header, wafers);
WriteJson(logistics, fileInfoCollection, result);
for (int i = 0; i < wafers.Count; i++)
{
if (wafers[i].Id != header.WaferSummary[i].Id)
{
header = null;
break;
}
}
if (header is null || wafers.Count != header.WaferSummary.Count)
result = null;
else
{
try
{
WriteTabSeparatedValues(logistics, fileInfoCollection, result);
}
catch (Exception ex)
{
WriteException(logistics, ex);
}
}
}
ReadOnlyCollection<string> waferIds = GetWaferIds(header);
ReadOnlyDictionary<string, Wafer> keyValuePairs = Wafer.Get(pages, constant, headerFileName);
ReadOnlyCollection<Wafer> wafers = Wafer.Get(waferIds, keyValuePairs);
result = new(header, wafers);
WriteJson(logistics, fileInfoCollection, result);
WriteTabSeparatedValues(logistics, fileInfoCollection, result);
}
return result;
}