static async Task Main(string[] args) { //GrpcEnvironment.SetLogger(new Grpc.Core.Logging.ConsoleLogger()); var host = "0.0.0.0"; var port = int.Parse(Environment.GetEnvironmentVariable("DFRAME_MASTER_CONNECT_TO_PORT") ?? "12345"); var workerConnectToHost = Environment.GetEnvironmentVariable("DFRAME_MASTER_CONNECT_TO_HOST") ?? $"dframe-master.local"; Console.WriteLine($"port {port}, workerConnectToHost {workerConnectToHost}"); var reportId = Environment.GetEnvironmentVariable("BENCH_REPORTID") ?? throw new ArgumentNullException($"Environment variables BENCH_REPORTID is missing."); var path = Environment.GetEnvironmentVariable("BENCH_S3BUCKET") ?? throw new ArgumentNullException($"Environment variables BENCH_S3BUCKET is missing."); if (Environment.GetEnvironmentVariable("IS_LOCAL")?.ToLower() == "true") { reportId = DateTime.Now.ToString("yyyyMMdd-HHmmss"); System.IO.File.WriteAllText("current_report_id", reportId); } Console.WriteLine($"bucket {path}, reportId {reportId}"); if (args.Length == 0) { // master args = "request -processCount 1 -workerPerProcess 1 -executePerWorker 1 -workerName UnaryWorker".Split(' '); //args = "request -processCount 1 -workerPerProcess 1 -executePerWorker 1 -workerName GrpcWorker".Split(' '); //args = "request -processCount 1 -workerPerProcess 1 -executePerWorker 1 -workerName ApiWorker".Split(' '); // expand thread pool //ModifyThreadPool(Environment.ProcessorCount * 5, Environment.ProcessorCount * 5); } else if (args.Contains("--worker-flag")) { // worker // connect to host = workerConnectToHost; } Console.WriteLine($"args {string.Join(", ", args)}, host {host}"); await Host.CreateDefaultBuilder(args) .ConfigureLogging(logging => { logging.ClearProviders(); logging.SetMinimumLevel(LogLevel.Trace); logging.AddZLoggerConsole(options => { options.EnableStructuredLogging = false; }); }) .RunDFrameAsync(args, new DFrameOptions(host, port, workerConnectToHost, port, new EcsScalingProvider()) { Timeout = TimeSpan.FromMinutes(120), OnExecuteResult = (results, option, scenario) => { using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10)); Console.WriteLine("Generating html."); var benchmarker = new Benchmarker(path, null, cts.Token); benchmarker.GenerateHtmlAsync(reportId).GetAwaiter().GetResult(); }, });