示例#1
0
        /// <summary>
        /// This method is called when a build request is completed on a particular node. NodeId is never used instead we look up the node from the build request
        /// and the schedule record table
        /// </summary>
        internal void NotifyOfBuildResult(int nodeId, BuildResult buildResult)
        {
            if (!childMode && nodes.Length > 1)
            {
                // Ignore host requests
                if (buildResult.HandleId == EngineCallback.invalidEngineHandle)
                {
                    return;
                }

                ScheduleRecordKey recordKey      = new ScheduleRecordKey(buildResult.HandleId, buildResult.RequestId);
                ScheduleRecord    scheduleRecord = null;
                lock (scheduleTableLock)
                {
                    ErrorUtilities.VerifyThrow(handleIdToScheduleRecord.ContainsKey(recordKey),
                                               "Schedule record should be in the table");

                    scheduleRecord = handleIdToScheduleRecord[recordKey];
                    totalRequestsPerNode[scheduleRecord.EvaluationNode]--;
                    handleIdToScheduleRecord.Remove(recordKey);

                    if (scheduleRecord.ParentKey.HandleId != EngineCallback.invalidEngineHandle)
                    {
                        ErrorUtilities.VerifyThrow(handleIdToScheduleRecord.ContainsKey(scheduleRecord.ParentKey),
                                                   "Parent schedule record should be in the table");
                        ScheduleRecord parentRecord = handleIdToScheduleRecord[scheduleRecord.ParentKey];

                        // As long as there are child requests under the parent request the parent request is considered blocked
                        // Remove this build request from the list of requests the parent request is waiting on. This may unblock the parent request
                        parentRecord.ReportChildCompleted(recordKey);

                        // If completing the child request has unblocked the parent request due to all of the the Child requests being completed
                        // decrement the number of blocked requests.
                        if (!parentRecord.Blocked)
                        {
                            blockedRequestsPerNode[parentRecord.EvaluationNode]--;
                        }
                    }
                }

                // Dump some interesting information to the console if profile build is turned on by an environment variable
                if (parentEngine.ProfileBuild && scheduleRecord != null && buildResult.TaskTime != 0)
                {
                    Console.WriteLine("N " + scheduleRecord.EvaluationNode + " Name " + scheduleRecord.ProjectName + ":" +
                                      scheduleRecord.ParentKey.HandleId + ":" + scheduleRecord.ParentKey.RequestId +
                                      " Total " + buildResult.TotalTime + " Engine " + buildResult.EngineTime + " Task " + buildResult.TaskTime);
                }
            }
        }