Skip to content

Add max_running_containers limit for resource management#80

Open
actflower wants to merge 2 commits intomainfrom
feature/limit-running-containers
Open

Add max_running_containers limit for resource management#80
actflower wants to merge 2 commits intomainfrom
feature/limit-running-containers

Conversation

@actflower
Copy link
Collaborator

Summary

  • Adds MAX_RUNNING_CONTAINERS configuration option to limit the number of containers running across all repos
  • When the limit is reached and a new task needs to run, the least recently used (LRU) idle container is automatically stopped
  • Containers actively processing tasks are never evicted
  • Default value is 0 (no limit) for backward compatibility
  • Includes fix for test mock config to support the new feature

This addresses the resource management concern when working with multiple repositories - each repo can have containers running across different dev names, and this provides a way to cap total resource usage.

Test plan

  • All 81 existing tests pass
  • LRU eviction logic only targets idle containers (verified by code review)
  • Manual testing with MAX_RUNNING_CONTAINERS=2 to verify eviction behavior

Closes #79

When multiple repositories are in use, each can have containers running
across different dev names. This change adds a configurable limit on the
maximum number of containers that can be running simultaneously.

When the limit is reached and a new task needs to run, the least recently
used idle container is automatically stopped to make room. Containers that
are actively processing tasks are never evicted.

Configuration:
- MAX_RUNNING_CONTAINERS: Set to limit (default: 0 = no limit)

Closes #79
Add max_running_containers = 0 to the mock_config fixture to prevent
TypeError when the eviction logic checks this config value during tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit number of containers

1 participant