batch_mode_batch_triple/
ensure_input_matches_error.rs

1// ---------------- [ File: src/ensure_input_matches_error.rs ]
2crate::ix!();
3
4impl BatchFileTriple {
5
6    pub async fn ensure_input_matches_error(&self) 
7        -> Result<(), BatchValidationError> 
8    {
9        // Load input and error files
10        let input_data = load_input_file(self.input().as_ref().unwrap()).await?;
11        let error_data = load_error_file(self.error().as_ref().unwrap()).await?;
12
13        // Compare request IDs
14        let input_ids: HashSet<_> = input_data.request_ids().into_iter().collect();
15        let error_ids: HashSet<_> = error_data.request_ids().into_iter().collect();
16
17        if input_ids != error_ids {
18            return Err(BatchValidationError::RequestIdsMismatch {
19                index: self.index().clone(),
20                input_ids:  Some(input_ids),
21                output_ids: None,
22                error_ids:  Some(error_ids),
23            });
24        }
25
26        info!("for our batch triple {:#?}, we have now ensured the input request ids match the request ids from the error file", self);
27
28        Ok(())
29    }
30}