MCPcopy Create free account
hub / github.com/clockworknowledge/menome_processor / get_task_info

Function get_task_info

worker/tasks.py:87–125  ·  view source on GitHub ↗
(task_id: str)

Source from the content-addressed store, hash-verified

85
86
87def get_task_info(task_id: str):
88 try:
89 task = AsyncResult(task_id)
90
91 # Task Not Ready
92 if not task.ready():
93 return {"task_id": str(task_id), "status": task.status}
94
95 # Task done: return the value
96 task_result = task.get(timeout=10) # Set a timeout for task.get() if needed
97 return {
98 "task_id": str(task_id),
99 "result": task_result,
100 "status": task.status
101 }
102
103 except TimeoutError:
104 # Handle timeout exceptions
105 return {
106 "task_id": str(task_id),
107 "error": "Timeout while retrieving the task result",
108 "status": "TIMEOUT"
109 }
110
111 except CeleryError as e:
112 # Handle general Celery errors
113 return {
114 "task_id": str(task_id),
115 "error": str(e),
116 "status": "ERROR"
117 }
118
119 except Exception as e:
120 # Handle other exceptions
121 return {
122 "task_id": str(task_id),
123 "error": f"An error occurred: {e}",
124 "status": "FAILURE"
125 }
126
127# Set up Neo4j driver (replace with your actual connection details)
128driver = GraphDatabase.driver(AppConfig.NEO4J_URI, auth=(AppConfig.NEO4J_USER, AppConfig.NEO4J_PASSWORD))

Callers 1

get_task_statusFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected