# Maximum Number of Concurrent Tasks in Pixelle-Video: Default Limit and Configuration Guide

> Discover the default 5 concurrent task limit in Pixelle-Video and learn how to configure this setting. Optimize your workflow with our easy-to-follow guide.

- Repository: [AIDC-AI/Pixelle-Video](https://github.com/AIDC-AI/Pixelle-Video)
- Tags: configuration-guide
- Published: 2026-04-23

---

**Pixelle-Video allows a maximum of 5 concurrent tasks by default, configurable via [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py).**

The **maximum number of concurrent tasks** in Pixelle-Video is a critical setting that prevents resource exhaustion and ensures predictable performance for video generation pipelines. This limit is enforced at the API level and can be adjusted based on your hardware capacity.

## Where the Concurrent Task Limit Is Defined

The default limit is specified in the `APIConfig` class within [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py):

```python
class APIConfig(BaseModel):
    ...
    # Task settings

    max_concurrent_tasks: int = 5          # ← maximum concurrent tasks

    ...

```

This **5-task default** balances resource consumption with throughput for typical deployment scenarios.

## Checking the Maximum Concurrent Tasks Limit at Runtime

You can verify whether a new task can be started by comparing active tasks against the configured limit:

```python
from api.config import api_config

def can_start_new_task(active_tasks: int) -> bool:
    """Return True if a new task may be started."""
    return active_tasks < api_config.max_concurrent_tasks

# Example usage

current_active = 3
if can_start_new_task(current_active):
    print("You can submit another video generation request.")
else:
    print("Maximum concurrent tasks reached – please wait.")

```

## How to Override the Maximum Concurrent Tasks Limit

Administrators can increase or decrease the limit based on available **CPU/GPU capacity**:

```python
from api.config import api_config

# Increase the limit to 8 (e.g., on a more powerful server)

api_config.max_concurrent_tasks = 8

print(f"New concurrency limit: {api_config.max_concurrent_tasks}")

```

Alternatively, modify the default value directly in [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) before starting the server.

## Key Files Controlling Task Concurrency

| File | Purpose |
|------|---------|
| [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) | Defines `max_concurrent_tasks = 5` in `APIConfig` class |
| [`pixelle_video/config/schema.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/pixelle_video/config/schema.py) | Schema for additional concurrency-related settings (e.g., RunningHub limit) |
| [`web/components/settings.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/web/components/settings.py) | UI component for modifying RunningHub concurrent limit (separate from API tasks) |

## Why the Maximum Concurrent Tasks Limit Matters

- **Resource protection**: Prevents GPU/CPU exhaustion that could crash the host machine
- **Predictable performance**: Ensures consistent latency for each video generation task
- **Operational flexibility**: Allows tuning based on deployment environment (single GPU vs. multi-GPU cluster)

## Summary

- **Default maximum concurrent tasks**: 5 tasks
- **Configuration location**: [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) in the `APIConfig` class
- **Runtime override**: Modify `api_config.max_concurrent_tasks` programmatically
- **Primary use case**: Control resource usage for video generation workloads

## Frequently Asked Questions

### Can I set the maximum concurrent tasks to unlimited?

No. Pixelle-Video requires a positive integer value for `max_concurrent_tasks`. Setting extremely high values risks resource exhaustion. The practical upper bound depends on your GPU memory and CPU cores.

### Does the maximum concurrent tasks limit apply to all users or per-user?

The `max_concurrent_tasks` setting in [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) applies globally to all API requests. Per-user limits would require additional middleware implementation not present in the base repository.

### What happens when the maximum concurrent tasks limit is reached?

New task requests are rejected or queued depending on the API implementation. The example code in [`api/config.py`](https://github.com/AIDC-AI/Pixelle-Video/blob/main/api/config.py) shows how to check availability before accepting tasks, preventing overload scenarios.