public bool LoadCacheGraph(string cachedGraphDirectory) { if (string.IsNullOrEmpty(cachedGraphDirectory) && string.IsNullOrEmpty(ExecutionLogPath)) { return(false); } // Dummy logger that nothing listens to but is needed for cached graph API LoggingContext loggingContext = new LoggingContext("BuildXL.Execution.Analyzer"); CachedGraphDirectory = !string.IsNullOrWhiteSpace(cachedGraphDirectory) ? cachedGraphDirectory : Path.Combine(Path.GetDirectoryName(ExecutionLogPath), Path.GetFileNameWithoutExtension(ExecutionLogPath)); using (ConsoleEventListener listener = new ConsoleEventListener(Events.Log, DateTime.UtcNow, eventMask: new EventMask( enabledEvents: null, disabledEvents: new int[] { (int)BuildXL.Engine.Tracing.LogEventId.DeserializedFile, // Don't log anything for success }) )) { listener.RegisterEventSource(BuildXL.Engine.ETWLogger.Log); CachedGraph = CachedGraph.LoadAsync(CachedGraphDirectory, loggingContext, preferLoadingEngineCacheInMemory: true, readStreamProvider: StreamProvider).GetAwaiter().GetResult(); } if (CachedGraph == null) { return(false); } return(true); }
protected async Task <CachedGraph> GetCachedGraphAsync(string buildId) { var loggingContext = new LoggingContext("Website"); var invocations = new Invocations().GetInvocations(loggingContext); var thisInvocation = invocations.First(invocation => invocation.SessionId == buildId); var entry = await Cache.GetOrCreateAsync( "CachedGraph: =" + buildId, (newEntry) => CachedGraph.LoadAsync( Path.Combine(thisInvocation.LogsFolder, "BuildXL"), loggingContext, true )); return(entry); }
public bool LoadCacheGraph(string cachedGraphDirectory) { if (string.IsNullOrEmpty(cachedGraphDirectory) && string.IsNullOrEmpty(ExecutionLogPath)) { return(false); } // Dummy logger that nothing listens to but is needed for cached graph API LoggingContext loggingContext = new LoggingContext("BuildXL.Execution.Analyzer"); CachedGraphDirectory = !string.IsNullOrWhiteSpace(cachedGraphDirectory) ? cachedGraphDirectory : Path.Combine(Path.GetDirectoryName(ExecutionLogPath), Path.GetFileNameWithoutExtension(ExecutionLogPath)); CachedGraph = CachedGraph.LoadAsync(CachedGraphDirectory, loggingContext, preferLoadingEngineCacheInMemory: true, readStreamProvider: StreamProvider).GetAwaiter().GetResult(); if (CachedGraph == null) { return(false); } return(true); }