Executor
Executor
dataclass
Executor(desc: str = 'Evaluating', show_progress: bool = True, keep_progress_bar: bool = True, jobs: List[Any] = list(), raise_exceptions: bool = False, batch_size: Optional[int] = None, run_config: Optional[RunConfig] = None, pbar: Optional[tqdm] = None, _jobs_processed: int = 0, _cancel_event: Event = Event())
Executor class for running asynchronous jobs with progress tracking and error handling.
Attributes:
| Name | Type | Description |
|---|---|---|
desc |
str
|
Description for the progress bar |
show_progress |
bool
|
Whether to show the progress bar |
keep_progress_bar |
bool
|
Whether to keep the progress bar after completion |
jobs |
List[Any]
|
List of jobs to execute |
raise_exceptions |
bool
|
Whether to raise exceptions or log them |
batch_size |
int
|
Whether to batch (large) lists of tasks |
run_config |
RunConfig
|
Configuration for the run |
_nest_asyncio_applied |
bool
|
Whether nest_asyncio has been applied |
_cancel_event |
Event
|
Event to signal cancellation |
cancel
is_cancelled
submit
Submit a job to be executed, wrapping the callable with error handling and indexing to keep track of the job index.
Source code in src/ragas/executor.py
clear_jobs
aresults
async
Execute all submitted jobs and return their results asynchronously. The results are returned in the order of job submission.
This is the async entry point for executing async jobs when already in an async context.
Source code in src/ragas/executor.py
results
Execute all submitted jobs and return their results. The results are returned in the order of job submission.
This is the main sync entry point for executing async jobs.
Source code in src/ragas/executor.py
run_async_batch
run_async_batch(desc: str, func: Callable, kwargs_list: List[Dict], batch_size: Optional[int] = None)
Provide functionality to run the same async function with different arguments in parallel.