Rename event_bus to crewai_event_bus for improved clarity and specificity

- Replace all references to `event_bus` with `crewai_event_bus`
- Update import statements across multiple files
- Remove the old `event_bus.py` file
- Maintain existing event handling functionality
This commit is contained in:
Lorenze Jay
2025-02-18 08:36:21 -08:00
parent 1603a1d9ac
commit 64569ce130
17 changed files with 182 additions and 296 deletions

View File

@@ -17,7 +17,7 @@ from crewai.tools import tool
from crewai.tools.tool_calling import InstructorToolCalling
from crewai.tools.tool_usage import ToolUsage
from crewai.utilities import RPMController
from crewai.utilities.events import event_bus
from crewai.utilities.events import crewai_event_bus
from crewai.utilities.events.tool_usage_events import ToolUsageFinishedEvent
@@ -156,11 +156,10 @@ def test_agent_execution_with_tools():
)
received_events = []
@event_bus.on(ToolUsageFinishedEvent)
@crewai_event_bus.on(ToolUsageFinishedEvent)
def handle_tool_end(source, event):
received_events.append(event)
# with patch.object(EventBus, "emit") as emit:
output = agent.execute_task(task)
assert output == "The result of the multiplication is 12."
@@ -256,7 +255,7 @@ def test_cache_hitting():
}
received_events = []
@event_bus.on(ToolUsageFinishedEvent)
@crewai_event_bus.on(ToolUsageFinishedEvent)
def handle_tool_end(source, event):
received_events.append(event)