surahman commented on a change in pull request #3786:
URL: https://github.com/apache/incubator-heron/pull/3786#discussion_r835974279



##########
File path: heron/tools/ui/src/python/main.py
##########
@@ -306,6 +309,34 @@ def file_download(
       headers={"Content-Disposition": f"attachment; filename={filename}"},
   )
 
+# List envelope for Exceptions response
+class ApiListEnvelope(pydantic.BaseModel):
+  """Envelope for heron-ui JSON API."""
+  status: str
+  message: str
+  version: str = VERSION
+  executiontime: int
+  result: list
+
+def api_topology_list_json(method: Callable[[], dict]) -> ApiListEnvelope:
+  """Wrap the output of a method with a response envelope."""
+  started = time.time()
+  result = method()
+  Log.debug(f"Api topology: {result}")
+  if type(result) is None:
+    return ApiEnvelope(
+        status="failure",
+        message="No topology found",
+        executiontime=time.time() - started,
+        result={},
+    )
+  else:
+    return ApiListEnvelope(
+        status="success",
+        message="",
+        executiontime=time.time() - started,
+        result=result,
+    )

Review comment:
       The `if` clause here will always return `false` and is dead code.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to