Skip to content

[Feature Request] Replace linear task search in TaskChannel of Workforce #3007

@Wendong-Fan

Description

@Wendong-Fan

Required prerequisites

Motivation

The TaskChannel class in task_channel.py currently uses a simple dictionary (_task_dict: Dict[str, Packet]) for task storage, leading to O(n) complexity for task retrieval.

Tasks:

  • Replace _task_dict with hybrid data structure:
    • Hash map for O(1) lookup by task ID
    • Status-based indexes for efficient filtering
  • Optimize get_assigned_task_by_assignee:
    • Maintain assignee->tasks index for O(1) lookup
    • Remove need for linear search
  • Improve concurrency:
    • Use read-write locks for better concurrent access
    • Implement fine-grained locking per assignee
    • Add batched operations to reduce lock acquisitions

Solution

No response

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

CAMEL 2.0P1Task with middle level priorityenhancementNew feature or request

Type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions