Kryst4lDem0ni4s commented on code in PR #188:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/188#discussion_r1977298635


##########
hugegraph-llm/src/hugegraph_llm/utils/decorators.py:
##########
@@ -90,3 +90,14 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
             log.debug("%s QPS: %f/s", args[0].__class__.__name__, qps)
         return result
     return wrapper
+
+# A decorator to wrap functions with a task id generation and logging
+def with_task_id(func):
+    def wrapper(*args, **kwargs):
+        import uuid
+        task_id = str(uuid.uuid4())
+        log.info(f"New task created with id: {task_id}")
+        # Optionally, you could also pass the task_id to the function if 
needed:
+        # kwargs['task_id'] = task_id
+        return func(*args, **kwargs)
+    return wrapper

Review Comment:
   Yes this one is useful, it's for generating concurrency ids, while the other 
is a more static general id useful for logging references (the one in the 
button) and can be modified or removed.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to