Class TaskPool
- Namespace
 - FoundationaLLM.Common.Tasks
 
- Assembly
 - FoundationaLLM.Common.dll
 
Represents a pool of active tasks with a predefined capacity.
public class TaskPool
  - Inheritance
 - 
      
      TaskPool
 
- Inherited Members
 
- Extension Methods
 
Remarks
This class is not thread safe, it assumes the taks pool is managed from a single thread.
Constructors
TaskPool(int, ILogger)
Represents a pool of active tasks with a predefined capacity.
public TaskPool(int maxConcurrentTasks, ILogger logger)
  Parameters
maxConcurrentTasksintIndicates the maximum number of tasks accepted by the task pool.
loggerILoggerThe ILogger used for logging.
Remarks
This class is not thread safe, it assumes the taks pool is managed from a single thread.
Properties
ActivePayloadIds
Retrieves the list of active payload identifiers for tasks that are currently active.
public List<string> ActivePayloadIds { get; }
  Property Value
AvailableCapacity
Indicates whether the task pool is at capacity or not.
public int AvailableCapacity { get; }
  Property Value
Methods
Add(IEnumerable<TaskInfo>)
Adds a new batch of tasks to the task pool.
public void Add(IEnumerable<TaskInfo> tasks)
  Parameters
tasksIEnumerable<TaskInfo>The list of TaskInfo items to be added to the pool.
Exceptions
- TaskPoolException
 The exception raised when a task cannot be added to the pool (e.g., the task pool is at capacity).
HasRunningTaskForPayload(string)
Determines whether the task pool already has a running task for a specified payload id.
public bool HasRunningTaskForPayload(string payloadId)
  Parameters
payloadIdstringThe identifier of the payload.
Returns
- bool
 True if the task pool already has a running task for the specified payload, false otherwise.