private static SlotRunData GetSlotRunDataLegacy(SlotRun slotRun) { var slotRunData = new SlotRunData(); foreach (var unitRun in slotRun.UnitRuns) { AddWorkUnitResult(slotRunData, unitRun.Data.WorkUnitResult); if (slotRunData.TotalCompletedUnits == null) { slotRunData.TotalCompletedUnits = unitRun.Data.TotalCompletedUnits; } } // try to get the status from the most recent unit run var lastUnitRun = slotRun.UnitRuns.FirstOrDefault(); if (lastUnitRun != null) { slotRunData.Status = GetSlotRunDataStatusLegacy(lastUnitRun.LogLines); } else { // otherwise, get the status from the parent ClientRun slotRunData.Status = GetSlotRunDataStatusLegacy(slotRun.Parent.LogLines); } return(slotRunData); }
/// <summary> /// Initializes a new instance of the <see cref="SlotRunData"/> class. /// </summary> /// <param name="other">The other instance from which data will be copied.</param> protected SlotRunData(SlotRunData other) { if (other == null) { return; } CompletedUnits = other.CompletedUnits; FailedUnits = other.FailedUnits; }
private static void AddWorkUnitResult(SlotRunData slotRunData, WorkUnitResult workUnitResult) { if (workUnitResult == WorkUnitResult.FinishedUnit) { slotRunData.CompletedUnits++; } else if (workUnitResult.IsTerminating()) { slotRunData.FailedUnits++; } }
private static SlotRunData GetSlotRunDataFahClient(SlotRun slotRun) { var slotRunData = new SlotRunData(); foreach (var unitRun in slotRun.UnitRuns) { AddWorkUnitResult(slotRunData, unitRun.Data.WorkUnitResult); } return(slotRunData); }