static void Main(string[] args) { if (args.Length < 1 || !uint.TryParse(args[0], out var numNodes)) { numNodes = 4; } Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); compiler.AddService <BankTestsService>(); var compiled = compiler.Compile(numNodes); Console.WriteLine("Building Host..."); var deploymentTimestamp = DateTime.UtcNow; var emulator = new EmulatorHost.Emulator($"bank/emulator/{deploymentTimestamp:o}", deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(compiled); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
static void Main(string[] args) { Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); uint numberProcesses = 5; uint workersPerProcess = 2; compiler .AddService <MinerService>() .AddBuildStep(serviceBuilder => serviceBuilder.OnFirstStart( new SearchJob() { Target = 100007394059441.GetHashCode(), Start = 100000000000000, Count = 10000000000, NumberWorkers = numberProcesses * workersPerProcess })) ; var application = compiler.Compile(numberProcesses); Console.WriteLine("Building Host..."); var deploymentTimestamp = DateTime.UtcNow; var emulator = new EmulatorHost.Emulator($"miner/emulator/{deploymentTimestamp:o}", deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(application); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
static void Main(string[] args) { if (args.Length < 1 || !uint.TryParse(args[0], out var numNodes)) { numNodes = 4; } var configuration = new EmulatorHost.Configuration() { MultiThreaded = true, ApplicationLogLevel = LogLevel.Trace, RuntimeLogLevel = LogLevel.Trace, FileLogLevel = LogLevel.Trace, LocalLogDirectory = "C:\\logs\\", }; var loggingConfig = new ReactiveMachine.LoggingConfiguration() { //SendLogLevel = LogLevel.Trace, //LockLogLevel = LogLevel.Trace }; Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); compiler.AddService <BankTestsService>(); compiler.AddBuildStep(sb => sb .SetConfiguration(configuration) .SetConfiguration(loggingConfig)); var compiled = compiler.Compile(numNodes); Console.WriteLine("Building Host..."); var deploymentTimestamp = DateTime.UtcNow; var emulator = new EmulatorHost.Emulator($"bank/emulator/{deploymentTimestamp:o}", deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(compiled); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
static void Main(string[] args) { Console.WriteLine("Building Application..."); var compiler = new ApplicationCompiler(); compiler.AddService <PingPongService>(); var application = compiler.Compile(2); Console.WriteLine("Starting Host..."); var deploymentTimestamp = DateTime.UtcNow; var emulator = new EmulatorHost.Emulator($"pingpong/emulator/{deploymentTimestamp:o}", deploymentTimestamp); emulator.Run(application); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
static void Main(string[] args) { var compiler = new ApplicationCompiler(); Console.WriteLine("Setting configuration objects..."); compiler.SetConfiguration(new HelloWorldTestConfiguration() { NumberRepetitions = 100 }); compiler.SetConfiguration(new ReactiveMachine.TelemetryBlobWriter.Configuration() { CollectHostEvents = true, CollectApplicationEvents = true, CollectThroughput = false, }); Console.WriteLine("Building Application..."); compiler.AddService <HelloWorldTestService>(); Console.WriteLine("Compiling Application..."); var compiledApplication = compiler.Compile(numberProcesses: 1); Console.WriteLine("Building Host..."); var deploymentTimestamp = DateTime.UtcNow; var deploymentId = $"helloworld/emulator/{deploymentTimestamp:o}"; var emulator = new EmulatorHost.Emulator(deploymentId, deploymentTimestamp); Console.WriteLine("Starting Host..."); emulator.Run(compiledApplication); Console.WriteLine("Done (hit enter to terminate)..."); Console.ReadLine(); emulator.Shutdown(); }
protected override void EndProcessing() { Action <string, object> writeVerbose = (targetType, target) => WriteVerbose($"Exporting {CachedObjects.Objects.Count()} object(s) to {targetType} {target}"); switch (ParameterSetName) { case "ToPath": var path = GetUnresolvedProviderPathFromPSPath(Path); writeVerbose("path", path); this.WriteObjectIf(!PassThru, Directory ? CachedObjects.WriteToFolder(path) : CachedObjects.WriteToFile(path).AsEnumerable()); this.WriteObjectIf(PassThru, CachedObjects); break; case "ToTextWriter": writeVerbose("TextWriter", ""); CachedObjects.WriteToTextWriter(TextWriter ?? Console.Out); this.WriteObjectIf(PassThru, CachedObjects); break; case "ToStream": writeVerbose("Stream", ""); CachedObjects.WriteToStream(Stream); this.WriteObjectIf(PassThru, CachedObjects); break; case "ToDatabase": writeVerbose("database", Database); ApplicationImporter.Import(CachedObjects, DevClientPath ?? DefaultDevClientPath, ServerName, Database, ImportAction); if (AutoCompile) { ApplicationCompiler.Compile(CachedObjects, DevClientPath ?? DefaultDevClientPath, ServerName, Database); } this.WriteObjectIf(PassThru, CachedObjects); break; } }
/// <exlude/> protected override void ProcessRecord() { ApplicationCompiler.Compile(Application, DevClientPath ?? DefaultDevClientPath, ServerName, Database); }