| 95 | } |
| 96 | |
| 97 | pub fn init_threads(parallel_raw: &Option<String>) -> Result<(), AppError> { |
| 98 | if let Some(ref raw_num) = *parallel_raw { |
| 99 | let num_threads = raw_num.parse::<usize>()?; |
| 100 | rayon::ThreadPoolBuilder::new().num_threads(num_threads).build_global().expect( |
| 101 | "Tried to initialize rayon more than once (this is a software bug on fw side, please file an issue at https://github.com/brocode/fw/issues/new )", |
| 102 | ); |
| 103 | } |
| 104 | Ok(()) |
| 105 | } |
| 106 | |
| 107 | pub fn foreach(maybe_config: Result<Config, AppError>, cmd: &str, tags: &BTreeSet<String>, parallel_raw: &Option<String>) -> Result<(), AppError> { |
| 108 | let config = maybe_config?; |