| Crates.io | batch-mode-batch-reconciliation |
| lib.rs | batch-mode-batch-reconciliation |
| version | 0.2.2 |
| created_at | 2025-02-27 05:58:42.530732+00 |
| updated_at | 2025-07-13 10:43:52.71787+00 |
| description | Provides a framework for reconciling batch files in batch processing workflows, with automatic determination of reconciliation steps, error handling, and file processing. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1571370 |
| size | 138,313 |
The batch-mode-batch-reconciliation crate provides functionality for reconciling batch files during a batch processing workflow. This includes determining and executing a series of reconciliation steps based on the current state of batch files (input, output, and error files). The crate supports both automated batch reconciliation and error recovery, and it is designed to integrate with other modules in the batch-mode ecosystem.
The main function of this crate is reconcile_unprocessed_batch_triple, which executes the reconciliation process for a batch file.
use batch_mode_batch_reconciliation::reconcile_unprocessed_batch_triple;
use batch_mode_batch_client::OpenAIClientHandle;
use batch_mode_batch_triple::BatchFileTriple;
use batch_mode_json::ExpectedContentType;
let client = OpenAIClientHandle::new();
let mut triple = BatchFileTriple::new(input_file, output_file, error_file);
let expected_content_type = ExpectedContentType::Json;
reconcile_unprocessed_batch_triple(&mut triple, &client, &expected_content_type, process_output_fn, process_error_fn).await?;
Define custom functions for processing batch output and error files. These functions will be invoked during the reconciliation process.
async fn process_output_fn(triple: &BatchFileTriple, workspace: &dyn BatchWorkspaceInterface, expected_content_type: &ExpectedContentType) {
// Custom logic for processing batch output
}
async fn process_error_fn(triple: &BatchFileTriple, operations: &[BatchErrorFileProcessingOperation]) {
// Custom logic for processing batch error files
}
The crate uses error-tree for detailed error handling. The main errors include:
BatchReconciliationError::MissingBatchInputFileButOthersExist: Missing the input file but output/error files exist.BatchReconciliationError::ReconciliationFailed: The reconciliation process failed due to errors in one or more steps.The crate supports several predefined reconciliation operations, such as:
This crate is licensed under the MIT License. See LICENSE for details.