Пример #1
0
      /// <summary>
      /// Aggregate Data and return UnitInfo Dictionary.
      /// </summary>
      public DataAggregatorResult AggregateData(ClientRun clientRun, UnitCollection unitCollection, Info info, Options options,
                                                SlotOptions slotOptions, UnitInfo currentUnitInfo, int slotId)
      {
         if (clientRun == null) throw new ArgumentNullException("clientRun");
         if (unitCollection == null) throw new ArgumentNullException("unitCollection");
         if (options == null) throw new ArgumentNullException("options");
         if (slotOptions == null) throw new ArgumentNullException("slotOptions");
         if (currentUnitInfo == null) throw new ArgumentNullException("currentUnitInfo");

         var result = new DataAggregatorResult();
         result.CurrentUnitIndex = -1;

         SlotRun slotRun = null;
         if (clientRun.SlotRuns.ContainsKey(slotId))
         {
            slotRun = clientRun.SlotRuns[slotId];
         }
         result.StartTime = clientRun.Data.StartTime;
         result.Arguments = clientRun.Data.Arguments;
         result.ClientVersion = clientRun.Data.ClientVersion;
         result.UserID = clientRun.Data.UserID;
         result.MachineID = clientRun.Data.MachineID;
         result.Status = slotRun != null ? slotRun.Data.Status : SlotStatus.Unknown;

         if (Logger.IsDebugEnabled)
         {
            foreach (var s in clientRun.Where(x => x.LineType == LogLineType.Error))
            {
               Logger.DebugFormat(Constants.ClientNameFormat, ClientName, String.Format("Failed to parse log line: {0}", s));
            }
         }

         GenerateUnitInfoDataFromQueue(result, slotRun, unitCollection, options, slotOptions, currentUnitInfo, slotId);
         result.Queue = BuildClientQueue(unitCollection, info, slotOptions, slotId);

         if (result.UnitInfos.ContainsKey(result.CurrentUnitIndex) && result.UnitInfos[result.CurrentUnitIndex].LogLines != null)
         {
            result.CurrentLogLines = result.UnitInfos[result.CurrentUnitIndex].LogLines;
         }
         else if (slotRun != null)
         {
            result.CurrentLogLines = slotRun.ToList();
         }
         else
         {
            result.CurrentLogLines = clientRun.ToList();
         }

         return result;
      }