Esempio n. 1
0
        private IPipGraphBuilder CreatePipGraphBuilder(
            LoggingContext loggingContext,
            MountsTable mountsTable,
            [CanBeNull] GraphReuseResult reuseResult)
        {
            var builder = new PipGraph.Builder(
                EngineSchedule.CreateEmptyPipTable(Context),
                Context,
                Scheduler.Tracing.Logger.Log,
                loggingContext,
                Configuration,
                mountsTable.MountPathExpander,
                fingerprintSalt: Configuration.Cache.CacheSalt,
                directoryMembershipFingerprinterRules: new Scheduler.DirectoryMembershipFingerprinterRuleSet(Configuration, Context.StringTable));

            PatchablePipGraph patchableGraph = null;

            if (Configuration.FrontEnd.UseGraphPatching() && reuseResult?.IsPartialReuse == true)
            {
                Logger.Log.UsingPatchableGraphBuilder(loggingContext);
                patchableGraph = new PatchablePipGraph(
                    oldPipGraph: reuseResult.PipGraph.DataflowGraph,
                    oldPipTable: reuseResult.PipGraph.PipTable,
                    graphBuilder: builder,
                    maxDegreeOfParallelism: Configuration.FrontEnd.MaxFrontEndConcurrency());
            }

            return((IPipGraphBuilder)patchableGraph ?? builder);
        }
Esempio n. 2
0
        public void TestAddSealDirectory()
        {
            var root = CreateUniqueSourcePath("root");
            var seal = CreateSealDirectory(root, SealDirectoryKind.Partial);

            PipGraphBuilder.AddSealDirectory(seal);
            var builder = new PatchablePipGraph(
                oldPipGraph: PipGraphBuilder.DirectedGraph,
                oldPipTable: PipTable,
                graphBuilder: CreatePipGraphBuilder(),
                maxDegreeOfParallelism: Environment.ProcessorCount);
            var stats = builder.PartiallyReloadGraph(new HashSet <AbsolutePath>());

            Assert.Equal(1, stats.NumPipsReloaded);
        }
Esempio n. 3
0
        private GraphReloadResult ReloadGraph(Pip[] procs, params int[] affectedIndexes)
        {
            XAssert.All(affectedIndexes, i => Assert.True(i >= 0 && i < procs.Length));

            // add meta pips only for non-affected processes, because they should be present in the reloaded graph
            var nonAffectedIndexes = Enumerable.Range(0, procs.Length).Except(affectedIndexes);
            var nonAffectedProcs   = nonAffectedIndexes.Select(i => procs[i]).ToArray();

            // partially reload graph into the newly created PipGraph.Builder
            var builder = new PatchablePipGraph(
                oldPipGraph: PipGraphBuilder.DirectedGraph,
                oldPipTable: PipTable,
                graphBuilder: CreatePipGraphBuilder(),
                maxDegreeOfParallelism: Environment.ProcessorCount);
            var affectedSpecs  = affectedIndexes.Select(i => procs[i].Provenance.Token.Path);
            var reloadingStats = builder.PartiallyReloadGraph(new HashSet <AbsolutePath>(affectedSpecs));

            // build and return the new PipGraph together with the statistics of graph reloading
            return(new GraphReloadResult()
            {
                PipGraph = builder.Build(),
                Stats = reloadingStats
            });
        }