protected override async Task ExecuteAsync(IConsole console) { var config = new PlottingConfiguration(Size, Path, CachePath, BucketCount, BufferSize); await ClientAccessor.StartPlotGenerationAsync(config); await InfoLineAsync("Plot creation started"); await InfoLineAsync("Use the Log Pool command to see the progress"); }
public async Task GeneratePlotAsync(PlottingConfiguration config) { var processInfo = new ProcessStartInfo() { WorkingDirectory = "/root", FileName = "/bin/bash", Arguments = $"generate.sh {config.Size} {config.Path} {config.CachePath} {config.BucketCount} {config.BufferSize}" }; using var process = Process.Start(processInfo); var logger = LoggerFactory.CreateLogger("Plotter"); process.OutputDataReceived += LogOutput; void LogOutput(object sender, DataReceivedEventArgs e) { logger.LogInformation(e.Data); } }
public async Task GeneratePlotAsync(PlottingConfiguration config) { var logger = LoggerFactory.CreateLogger("Plotting"); var sw = new Stopwatch(); sw.Start(); string command = $"cd chia-blockchain && . ./activate && chia plots create -k {config.Size} -d {config.Path} -t {config.CachePath} -u {config.BucketCount} -b {config.BufferSize}"; logger.LogInformation(command); int exitCode = await ShellHelper.RunBashAsync(command, logger); sw.Stop(); if (exitCode == 0) { logger.LogInformation($"Finished plotting process after {sw.Elapsed.TotalMinutes} minutes"); } else { logger.LogError($"Plotting failed after {sw.Elapsed.TotalMinutes} minutes"); } }
public static async Task <int> RunPlotGenerationAsync(PlottingConfiguration config, ILogger logger) { var sw = new Stopwatch(); sw.Start(); string command = $"cd /root/chia-blockchain && . ./activate && chia plots create -k {config.Size} -d {config.Path} -t {config.CachePath} -u {config.BucketCount} -b {config.BufferSize}"; logger.LogInformation(command); int exitCode = await RunBashAsync(command, logger); sw.Stop(); if (exitCode == 0) { logger.LogInformation($"Finished plotting process after {sw.Elapsed.TotalMinutes} minutes"); } else { logger.LogError($"Plotting failed after {sw.Elapsed.TotalMinutes} minutes"); } return(exitCode); }
public async Task <IActionResult> StartPlotGenerationAsync([FromForm] PlottingConfiguration configuration) { _ = Task.Run(() => PlotManager.GeneratePlotAsync(configuration)); return(Ok()); }
public async Task GeneratePlotAsync(PlottingConfiguration config) { var logger = LoggerFactory.CreateLogger("Plotting"); await ShellHelper.RunPlotGenerationAsync(config, logger); }
public Task StartPlotGenerationAsync(PlottingConfiguration configuration) => PostAsync(ClientRoutes.StartPlotGeneration(ApiUrl), configuration);
public IActionResult StartPlotGeneration([FromBody] PlottingConfiguration configuration) { _ = Task.Run(() => PlotManager.GeneratePlotAsync(configuration)); return(Ok()); }
public Task StartPlotGenerationAsync(PlottingConfiguration configuration) => PostAsync(MinerRoutes.StartPlotGeneration(), configuration);