private static ClientRunData GetClientRunDataFahClient(ClientRun clientRun) { var clientRunData = new ClientRunData(); foreach (var line in clientRun.LogLines) { switch (line.LineType) { case LogLineType.LogOpen: clientRunData.StartTime = (DateTime)line.LineData; break; } } return clientRunData; }
private static ClientRunData GetClientRunDataLegacy(ClientRun clientRun) { var clientRunData = new ClientRunData(); foreach (var line in clientRun.LogLines) { if (line.LineType == LogLineType.LogOpen) { clientRunData.StartTime = (DateTime)line.LineData; } else if (line.LineType == LogLineType.ClientVersion) { clientRunData.ClientVersion = line.LineData.ToString(); } else if (line.LineType == LogLineType.ClientArguments) { clientRunData.Arguments = line.LineData.ToString(); } else if (line.LineType == LogLineType.ClientUserNameTeam) { var userAndTeam = (Tuple<string, int>)line.LineData; clientRunData.FoldingID = userAndTeam.Item1; clientRunData.Team = userAndTeam.Item2; } else if (line.LineType == LogLineType.ClientUserID || line.LineType == LogLineType.ClientReceivedUserID) { clientRunData.UserID = line.LineData.ToString(); } else if (line.LineType == LogLineType.ClientMachineID) { clientRunData.MachineID = (int)line.LineData; } } return clientRunData; }
private static void UpdateUnitInfoFromLogData(UnitInfo unitInfo, ClientRunData clientRunData, UnitRunData unitRunData, UnitInfoLogData unitInfoLogData) { Debug.Assert(unitInfo != null); Debug.Assert(clientRunData != null); Debug.Assert(unitRunData != null); // unitInfoLogData can be null /* Project (R/C/G) (Could have already been read through Queue) */ if (unitInfo.ProjectIsUnknown()) { unitInfo.ProjectID = unitRunData.ProjectID; unitInfo.ProjectRun = unitRunData.ProjectRun; unitInfo.ProjectClone = unitRunData.ProjectClone; unitInfo.ProjectGen = unitRunData.ProjectGen; } if (unitRunData.Threads > 1) { unitInfo.SlotType = SlotType.CPU; } if (unitInfoLogData != null) { unitInfo.ProteinName = unitInfoLogData.ProteinName; /* Tag (Could have already been read through Queue) */ if (unitInfo.ProteinTag.Length == 0) { unitInfo.ProteinTag = unitInfoLogData.ProteinTag; } /* DownloadTime (Could have already been read through Queue) */ if (unitInfo.DownloadTime.IsUnknown()) { unitInfo.DownloadTime = unitInfoLogData.DownloadTime; } /* DueTime (Could have already been read through Queue) */ if (unitInfo.DueTime.IsUnknown()) { unitInfo.DueTime = unitInfoLogData.DueTime; } /* FinishedTime (Not available in unitinfo log) */ /* Project (R/C/G) (Could have already been read through Queue) */ if (unitInfo.ProjectIsUnknown()) { unitInfo.ProjectID = unitInfoLogData.ProjectID; unitInfo.ProjectRun = unitInfoLogData.ProjectRun; unitInfo.ProjectClone = unitInfoLogData.ProjectClone; unitInfo.ProjectGen = unitInfoLogData.ProjectGen; } } /* FoldingID and Team from last ClientRun (Could have already been read through Queue) */ if (unitInfo.FoldingID == Constants.DefaultFoldingID && unitInfo.Team == Constants.DefaultTeam) { if (!String.IsNullOrEmpty(clientRunData.FoldingID)) { unitInfo.FoldingID = clientRunData.FoldingID; unitInfo.Team = clientRunData.Team; } } // The queue will have the FoldingID and Team that was set in the client when the work unit was assigned. // If the user subsequently changed their FoldingID and Team before this unit was completed the // FoldingID and Team read from the queue will NOT reflect that change. //if (unitInfo.FoldingID != clientRunData.FoldingID || unitInfo.Team != clientRunData.Team) //{ // if (!String.IsNullOrEmpty(clientRunData.FoldingID)) // { // unitInfo.FoldingID = clientRunData.FoldingID; // unitInfo.Team = clientRunData.Team; // } //} }
private static void UpdateUnitInfoFromLogData(UnitInfo unitInfo, ClientRunData clientRunData, UnitRunData unitRunData, UnitInfoLogData unitInfoLogData) { Debug.Assert(unitInfo != null); Debug.Assert(clientRunData != null); Debug.Assert(unitRunData != null); // unitInfoLogData can be null /* Project (R/C/G) (Could have already been read through Queue) */ if (unitInfo.ProjectIsUnknown()) { unitInfo.ProjectID = unitRunData.ProjectID; unitInfo.ProjectRun = unitRunData.ProjectRun; unitInfo.ProjectClone = unitRunData.ProjectClone; unitInfo.ProjectGen = unitRunData.ProjectGen; } if (unitRunData.Threads > 1) { unitInfo.SlotType = SlotType.CPU; } if (unitInfoLogData != null) { unitInfo.ProteinName = unitInfoLogData.ProteinName; /* Tag (Could have already been read through Queue) */ if (unitInfo.ProteinTag.Length == 0) { unitInfo.ProteinTag = unitInfoLogData.ProteinTag; } /* DownloadTime (Could have already been read through Queue) */ if (unitInfo.DownloadTime.IsUnknown()) { unitInfo.DownloadTime = unitInfoLogData.DownloadTime; } /* DueTime (Could have already been read through Queue) */ if (unitInfo.DueTime.IsUnknown()) { unitInfo.DueTime = unitInfoLogData.DueTime; } /* FinishedTime (Not available in unitinfo log) */ /* Project (R/C/G) (Could have already been read through Queue) */ if (unitInfo.ProjectIsUnknown()) { unitInfo.ProjectID = unitInfoLogData.ProjectID; unitInfo.ProjectRun = unitInfoLogData.ProjectRun; unitInfo.ProjectClone = unitInfoLogData.ProjectClone; unitInfo.ProjectGen = unitInfoLogData.ProjectGen; } } /* FoldingID and Team from last ClientRun (Could have already been read through Queue) */ if (unitInfo.FoldingID == Constants.DefaultFoldingID && unitInfo.Team == Constants.DefaultTeam) { if (!String.IsNullOrEmpty(clientRunData.FoldingID)) { unitInfo.FoldingID = clientRunData.FoldingID; unitInfo.Team = clientRunData.Team; } } // The queue will have the FoldingID and Team that was set in the client when the work unit was assigned. // If the user subsequently changed their FoldingID and Team before this unit was completed the // FoldingID and Team read from the queue will NOT reflect that change. //if (unitInfo.FoldingID != clientRunData.FoldingID || unitInfo.Team != clientRunData.Team) //{ // if (!String.IsNullOrEmpty(clientRunData.FoldingID)) // { // unitInfo.FoldingID = clientRunData.FoldingID; // unitInfo.Team = clientRunData.Team; // } //} }