🐛 fix(chat.py): change BuildStatus.IN_PROGRESS to BuildStatus.STARTED for better clarity

🐛 fix(chat.py): fix incorrect key used to retrieve graph_data from flow_data_store
The BuildStatus.IN_PROGRESS constant is changed to BuildStatus.STARTED to provide a more accurate representation of the flow status. Additionally, the incorrect key "data" is replaced with "graph_data" when retrieving the graph data from the flow_data_store dictionary.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-29 10:54:27 -03:00
commit f1e2bbb69c
2 changed files with 4 additions and 2 deletions

View file

@ -47,7 +47,7 @@ async def init_build(graph_data: dict, flow_id: str):
logger.debug(f"Deleted flow {flow_id} from cache")
flow_data_store[flow_id] = {
"graph_data": graph_data,
"status": BuildStatus.IN_PROGRESS,
"status": BuildStatus.STARTED,
}
return InitResponse(flowId=flow_id)
@ -91,7 +91,7 @@ async def stream_build(flow_id: str):
yield str(StreamData(event="error", data={"error": error_message}))
return
graph_data = flow_data_store[flow_id].get("data")
graph_data = flow_data_store[flow_id].get("graph_data")
if not graph_data:
error_message = "No data provided"
@ -109,6 +109,7 @@ async def stream_build(flow_id: str):
return
number_of_nodes = len(graph.nodes)
flow_data_store[flow_id]["status"] = BuildStatus.IN_PROGRESS
for i, vertex in enumerate(graph.generator_build(), 1):
try:
log_dict = {

View file

@ -11,6 +11,7 @@ class BuildStatus(Enum):
SUCCESS = "success"
FAILURE = "failure"
STARTED = "started"
IN_PROGRESS = "in_progress"