Пример #1
0
        public async Task <int> OnExecuteAsync(IConsole console)
        {
            try
            {
                var podraceContext =
                    await PodraceContext.LoadAsync(string.IsNullOrEmpty(BasePath)
                                                   ?Directory.GetCurrentDirectory()
                                                       : BasePath);

                // Create a Race session
                var race = new PodraceSession(podraceContext, _loggerFactory, outputDirectory: null);

                _logger.LogInformation("Removing all Kubernetes resources for {RaceName}", podraceContext.Name);
                await race.RemoveAsync();

                _logger.LogInformation("Removed all Kubernetes resources for {RaceName}", podraceContext.Name);

                return(0);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "An unexpected error occurred.");
                return(1);
            }
        }
Пример #2
0
        public async Task <int> OnExecuteAsync(IConsole console)
        {
            try
            {
                var podraceContext =
                    await PodraceContext.LoadAsync(string.IsNullOrEmpty(BasePath)
                                                   ?Directory.GetCurrentDirectory()
                                                       : BasePath);

                // Create a Race session
                var outDir = string.IsNullOrEmpty(OutputDirectory) ? Directory.GetCurrentDirectory() : OutputDirectory;
                var race   = new PodraceSession(podraceContext, _loggerFactory, outDir);

                try
                {
                    // Deploy the race
                    await race.DeployAsync();

                    // Run the warmup
                    await race.WarmupAsync();

                    // Run the benchmark!
                    await race.RunAsync();

                    // Collect outputs
                    await race.CollectAsync();
                }
                finally
                {
                    if (!NoClean)
                    {
                        _logger.LogInformation("Cleaning up race resources...");
                        await race.RemoveAsync();
                    }
                    else
                    {
                        _logger.LogWarning("Skipping clean-up because --no-clean was set.");
                    }
                }

                return(0);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "An unexpected error occurred.");
                return(1);
            }
        }