Rename PipelineData.pipeline_runs to pipeline_debug (#100907)
parent
b0a7e68984
commit
1e76d37cee
|
@ -499,11 +499,11 @@ class PipelineRun:
|
|||
raise InvalidPipelineStagesError(self.start_stage, self.end_stage)
|
||||
|
||||
pipeline_data: PipelineData = self.hass.data[DOMAIN]
|
||||
if self.pipeline.id not in pipeline_data.pipeline_runs:
|
||||
pipeline_data.pipeline_runs[self.pipeline.id] = LimitedSizeDict(
|
||||
if self.pipeline.id not in pipeline_data.pipeline_debug:
|
||||
pipeline_data.pipeline_debug[self.pipeline.id] = LimitedSizeDict(
|
||||
size_limit=STORED_PIPELINE_RUNS
|
||||
)
|
||||
pipeline_data.pipeline_runs[self.pipeline.id][self.id] = PipelineRunDebug()
|
||||
pipeline_data.pipeline_debug[self.pipeline.id][self.id] = PipelineRunDebug()
|
||||
|
||||
# Initialize with audio settings
|
||||
self.audio_processor_buffer = AudioBuffer(AUDIO_PROCESSOR_BYTES)
|
||||
|
@ -518,10 +518,10 @@ class PipelineRun:
|
|||
"""Log an event and call listener."""
|
||||
self.event_callback(event)
|
||||
pipeline_data: PipelineData = self.hass.data[DOMAIN]
|
||||
if self.id not in pipeline_data.pipeline_runs[self.pipeline.id]:
|
||||
if self.id not in pipeline_data.pipeline_debug[self.pipeline.id]:
|
||||
# This run has been evicted from the logged pipeline runs already
|
||||
return
|
||||
pipeline_data.pipeline_runs[self.pipeline.id][self.id].events.append(event)
|
||||
pipeline_data.pipeline_debug[self.pipeline.id][self.id].events.append(event)
|
||||
|
||||
def start(self, device_id: str | None) -> None:
|
||||
"""Emit run start event."""
|
||||
|
@ -1559,7 +1559,7 @@ class PipelineStorageCollectionWebsocket(
|
|||
class PipelineData:
|
||||
"""Store and debug data stored in hass.data."""
|
||||
|
||||
pipeline_runs: dict[str, LimitedSizeDict[str, PipelineRunDebug]]
|
||||
pipeline_debug: dict[str, LimitedSizeDict[str, PipelineRunDebug]]
|
||||
pipeline_store: PipelineStorageCollection
|
||||
pipeline_devices: set[str] = field(default_factory=set, init=False)
|
||||
|
||||
|
|
|
@ -258,18 +258,18 @@ def websocket_list_runs(
|
|||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = msg["pipeline_id"]
|
||||
|
||||
if pipeline_id not in pipeline_data.pipeline_runs:
|
||||
if pipeline_id not in pipeline_data.pipeline_debug:
|
||||
connection.send_result(msg["id"], {"pipeline_runs": []})
|
||||
return
|
||||
|
||||
pipeline_runs = pipeline_data.pipeline_runs[pipeline_id]
|
||||
pipeline_debug = pipeline_data.pipeline_debug[pipeline_id]
|
||||
|
||||
connection.send_result(
|
||||
msg["id"],
|
||||
{
|
||||
"pipeline_runs": [
|
||||
{"pipeline_run_id": id, "timestamp": pipeline_run.timestamp}
|
||||
for id, pipeline_run in pipeline_runs.items()
|
||||
for id, pipeline_run in pipeline_debug.items()
|
||||
]
|
||||
},
|
||||
)
|
||||
|
@ -294,7 +294,7 @@ def websocket_get_run(
|
|||
pipeline_id = msg["pipeline_id"]
|
||||
pipeline_run_id = msg["pipeline_run_id"]
|
||||
|
||||
if pipeline_id not in pipeline_data.pipeline_runs:
|
||||
if pipeline_id not in pipeline_data.pipeline_debug:
|
||||
connection.send_error(
|
||||
msg["id"],
|
||||
websocket_api.const.ERR_NOT_FOUND,
|
||||
|
@ -302,9 +302,9 @@ def websocket_get_run(
|
|||
)
|
||||
return
|
||||
|
||||
pipeline_runs = pipeline_data.pipeline_runs[pipeline_id]
|
||||
pipeline_debug = pipeline_data.pipeline_debug[pipeline_id]
|
||||
|
||||
if pipeline_run_id not in pipeline_runs:
|
||||
if pipeline_run_id not in pipeline_debug:
|
||||
connection.send_error(
|
||||
msg["id"],
|
||||
websocket_api.const.ERR_NOT_FOUND,
|
||||
|
@ -314,7 +314,7 @@ def websocket_get_run(
|
|||
|
||||
connection.send_result(
|
||||
msg["id"],
|
||||
{"events": pipeline_runs[pipeline_run_id].events},
|
||||
{"events": pipeline_debug[pipeline_run_id].events},
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ async def test_text_only_pipeline(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -153,8 +153,8 @@ async def test_audio_pipeline(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -316,8 +316,8 @@ async def test_audio_pipeline_with_wake_word_no_timeout(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -452,8 +452,8 @@ async def test_intent_timeout(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -505,8 +505,8 @@ async def test_text_pipeline_timeout(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -573,8 +573,8 @@ async def test_intent_failed(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -628,8 +628,8 @@ async def test_audio_pipeline_timeout(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -760,8 +760,8 @@ async def test_stt_stream_failed(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -828,8 +828,8 @@ async def test_tts_failed(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
@ -1792,8 +1792,8 @@ async def test_audio_pipeline_with_enhancements(
|
|||
events.append(msg["event"])
|
||||
|
||||
pipeline_data: PipelineData = hass.data[DOMAIN]
|
||||
pipeline_id = list(pipeline_data.pipeline_runs)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_runs[pipeline_id])[0]
|
||||
pipeline_id = list(pipeline_data.pipeline_debug)[0]
|
||||
pipeline_run_id = list(pipeline_data.pipeline_debug[pipeline_id])[0]
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue