improve xtask
This commit is contained in:
		| @@ -239,6 +239,8 @@ fn regression() -> Result<(), DynError> { | ||||
|     let res = try_regression(); | ||||
|  | ||||
|     snake.kill().and(prod.kill())?; | ||||
|     stop_local_docker()?; | ||||
|     stop_production()?; | ||||
|     let (won, draw, loose) = res?; | ||||
|     let games = won + draw + loose; | ||||
|     println!( | ||||
| @@ -265,7 +267,7 @@ fn try_regression() -> Result<(usize, usize, usize), DynError> { | ||||
|     const GAMES: usize = 100; | ||||
|     // limit the parallelism | ||||
|     rayon::ThreadPoolBuilder::new() | ||||
|         .num_threads(std::thread::available_parallelism()?.get() / 8) | ||||
|         .num_threads(std::thread::available_parallelism()?.get() / 4) | ||||
|         .build_global() | ||||
|         .unwrap(); | ||||
|  | ||||
| @@ -401,6 +403,13 @@ fn run_local_docker(port: u16) -> Result<Child, DynError> { | ||||
|     } | ||||
| } | ||||
|  | ||||
| fn stop_local_docker() -> Result<(), DynError> { | ||||
|     Command::new("docker") | ||||
|         .args(["stop", "battlesnake-regression-local"]) | ||||
|         .status()?; | ||||
|     Ok(()) | ||||
| } | ||||
|  | ||||
| fn run_production(port: u16) -> Result<Child, DynError> { | ||||
|     let mut snake = Command::new("docker") | ||||
|         .args([ | ||||
| @@ -431,6 +440,13 @@ fn run_production(port: u16) -> Result<Child, DynError> { | ||||
|     } | ||||
| } | ||||
|  | ||||
| fn stop_production() -> Result<(), DynError> { | ||||
|     Command::new("docker") | ||||
|         .args(["stop", "battlesnake-regression-production"]) | ||||
|         .status()?; | ||||
|     Ok(()) | ||||
| } | ||||
|  | ||||
| fn docker() -> Result<(), DynError> { | ||||
|     if !Command::new("docker") | ||||
|         .current_dir(project_root()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user