public void dbgDisplayIndex(Scheduler dbgScheduler) { List <WaitRecord> waitRecords = new List <WaitRecord>(this.waitingVerbs.Values); for (int i = 0; i < waitRecords.Count(); i++) { WaitRecord wr = waitRecords[i]; List <int> depNums = new List <int>(); List <BuildObject> unknownDeps = new List <BuildObject>(); List <string> unscheduledDeps = new List <string>(); foreach (BuildObject dep in wr.knownDeps) { IVerb depOnVerb = dbgScheduler.getParent(dep); if (depOnVerb == null) { unknownDeps.Add(dep); } else if (!this.waitingVerbs.ContainsKey(depOnVerb)) { unscheduledDeps.Add( string.Format( "{0} waiting on {1} {2}", dep, depOnVerb, dbgScheduler.dbgGetVerbStatus(depOnVerb))); } else { WaitRecord depWr = this.waitingVerbs[depOnVerb]; depNums.Add(waitRecords.IndexOf(depWr)); } } Logger.WriteLine( string.Format( "{0}. {1} waits on ({2}), {3} unknown, {4} unscheduled", i, wr.verb, string.Join(",", depNums), unknownDeps.Count(), unscheduledDeps.Count())); this.dbgPreview("Unknown", unknownDeps.Select(it => it.ToString()), 3); this.dbgPreview("Unscheduled", unscheduledDeps, 20); } }
public void dbgDisplayIndex(Scheduler dbgScheduler) { List<WaitRecord> waitRecords = new List<WaitRecord>(this.waitingVerbs.Values); for (int i = 0; i < waitRecords.Count(); i++) { WaitRecord wr = waitRecords[i]; List<int> depNums = new List<int>(); List<BuildObject> unknownDeps = new List<BuildObject>(); List<string> unscheduledDeps = new List<string>(); foreach (BuildObject dep in wr.knownDeps) { IVerb depOnVerb = dbgScheduler.getParent(dep); if (depOnVerb == null) { unknownDeps.Add(dep); } else if (!this.waitingVerbs.ContainsKey(depOnVerb)) { unscheduledDeps.Add( string.Format( "{0} waiting on {1} {2}", dep, depOnVerb, dbgScheduler.dbgGetVerbStatus(depOnVerb))); } else { WaitRecord depWr = this.waitingVerbs[depOnVerb]; depNums.Add(waitRecords.IndexOf(depWr)); } } Logger.WriteLine( string.Format( "{0}. {1} waits on ({2}), {3} unknown, {4} unscheduled", i, wr.verb, string.Join(",", depNums), unknownDeps.Count(), unscheduledDeps.Count())); this.dbgPreview("Unknown", unknownDeps.Select(it => it.ToString()), 3); this.dbgPreview("Unscheduled", unscheduledDeps, 20); } }
void main(string[] cmdline_args) { string[] all_args = fetchConfigArgs().Concat(cmdline_args).ToArray(); logNubuildInvocation(all_args); try { parseArgs(all_args); } catch (UserError err) { usage(err.Message); } BuildEngine.theEngine.ItemCache = GetItemCache(); BuildEngine.theEngine.Repository = new Repository(BuildEngine.theEngine.ItemCache); if (this.useCloudExecution) { if (!this.useCloudCache) { usage("Cloud Execution requires Cloud Cache!"); } BuildEngine.theEngine.CloudReportQueueName = Path.GetRandomFileName().Substring(0, 8); BuildEngine.theEngine.CloudExecutionQueue = new CloudExecutionQueue(BuildEngine.theEngine.CloudReportQueueName); Logger.WriteLine("Using cloud report queue name: " + BuildEngine.theEngine.CloudReportQueueName); } Scheduler scheduler = new Scheduler(jobParallelism); scheduler.addTargetVerbs(verbs); ////try ////{ scheduler.parallelSchedule(); ////} ////catch (Exception ex) ////{ //// scheduler.dbgDisplayCounts(); //// throw; ////} IEnumerable<BuildObject> targets = scheduler.getTargets(); BuildObject outputTarget = null; if (targets.Count() > 0) { outputTarget = targets.First(); } else { Logger.WriteLine("No targets requested."); } if (targets.Count() > 1) { // TODO need a better story for relaying failure results. Right now // they get stuck in the results cache, but don't appear where we // can find them. Emit to a log, or to files in nuobj? Logger.WriteLine("Multiple targets build. First result follows."); } if (outputTarget != null) { Disposition d = scheduler.getObjectDisposition(outputTarget); if (d is Fresh) { ASCIIPresentater ascii = new ASCIIPresentater(); IVerb verb = scheduler.getParent(outputTarget); verb.getPresentation().format(ascii); Logger.Write(ascii.ToString()); if (this.html_output != null) { HTMLPresentater html = new HTMLPresentater(); verb.getPresentation().format(html); try { using (StreamWriter sw = new StreamWriter(this.html_output)) { sw.Write(html.ToString()); } } catch (Exception e) { Logger.WriteLine("Failed to write html output to file: " + html_output); Logger.WriteLine("Exception was: " + e); } } } else { Logger.WriteLine("Build failed."); foreach (string msg in d.getMessages()) { Logger.Write(msg); } } } else if (targets.Count() == 0) { Logger.WriteLine("No targets requested."); } else { Logger.WriteLine("Multiple targets built. Look for results in nuobj/."); } // - // We have to explicitly ask the BackgroundWorker thread to exit // as it will prevent the process from exiting until it does. // - this.backgroundWorker.StopWork(); // - // Report what the background worker accomplished during this run. // - this.backgroundWorker.WaitForCompletion(); Logger.WriteLine(string.Format("Background Worker completed {0} work items out of {1} queued.", this.backgroundWorker.GetWorkItemsPerformed, this.backgroundWorker.GetWorkItemsQueued)); if (this.backgroundWorker.GetWorkItemsFailed != 0) { Logger.WriteLine(string.Format( "{0} work item procedures failed (threw an exception).", this.backgroundWorker.GetWorkItemsFailed)); } }
void main(string[] cmdline_args) { string[] all_args = fetchConfigArgs().Concat(cmdline_args).ToArray(); logNubuildInvocation(all_args); try { parseArgs(all_args); } catch (UserError err) { usage(err.Message); } BuildEngine.theEngine.ItemCache = GetItemCache(); BuildEngine.theEngine.Repository = new Repository(BuildEngine.theEngine.ItemCache); if (this.useCloudExecution) { if (!this.useCloudCache) { usage("Cloud Execution requires Cloud Cache!"); } BuildEngine.theEngine.CloudReportQueueName = Path.GetRandomFileName().Substring(0, 8); // BuildEngine.theEngine.CloudExecutionQueue = new CloudExecutionQueue(BuildEngine.theEngine.CloudReportQueueName); Logger.WriteLine("Using cloud report queue name: " + BuildEngine.theEngine.CloudReportQueueName); } Scheduler scheduler = new Scheduler(jobParallelism); scheduler.addTargetVerbs(verbs); ////try ////{ scheduler.parallelSchedule(); ////} ////catch (Exception ex) ////{ //// scheduler.dbgDisplayCounts(); //// throw; ////} IEnumerable <BuildObject> targets = scheduler.getTargets(); BuildObject outputTarget = null; if (targets.Count() > 0) { outputTarget = targets.First(); } else { Logger.WriteLine("No targets requested."); } if (targets.Count() > 1) { // TODO need a better story for relaying failure results. Right now // they get stuck in the results cache, but don't appear where we // can find them. Emit to a log, or to files in nuobj? Logger.WriteLine("Multiple targets build. First result follows."); } if (outputTarget != null) { Disposition d = scheduler.getObjectDisposition(outputTarget); if (d is Fresh) { ASCIIPresentater ascii = new ASCIIPresentater(); IVerb verb = scheduler.getParent(outputTarget); verb.getPresentation().format(ascii); Logger.Write(ascii.ToString()); if (this.html_output != null) { HTMLPresentater html = new HTMLPresentater(); verb.getPresentation().format(html); try { using (StreamWriter sw = new StreamWriter(this.html_output)) { sw.Write(html.ToString()); } } catch (Exception e) { Logger.WriteLine("Failed to write html output to file: " + html_output); Logger.WriteLine("Exception was: " + e); } } } else { Logger.WriteLine("Build failed."); foreach (string msg in d.getMessages()) { Logger.Write(msg); } } } else if (targets.Count() == 0) { Logger.WriteLine("No targets requested."); } else { Logger.WriteLine("Multiple targets built. Look for results in nuobj/."); } // - // We have to explicitly ask the BackgroundWorker thread to exit // as it will prevent the process from exiting until it does. // - this.backgroundWorker.StopWork(); // - // Report what the background worker accomplished during this run. // - this.backgroundWorker.WaitForCompletion(); Logger.WriteLine(string.Format("Background Worker completed {0} work items out of {1} queued.", this.backgroundWorker.GetWorkItemsPerformed, this.backgroundWorker.GetWorkItemsQueued)); if (this.backgroundWorker.GetWorkItemsFailed != 0) { Logger.WriteLine(string.Format( "{0} work item procedures failed (threw an exception).", this.backgroundWorker.GetWorkItemsFailed)); } }