Kryst4lDem0ni4s commented on code in PR #188:
URL:
https://github.com/apache/incubator-hugegraph-ai/pull/188#discussion_r1983509402
##########
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:
Understood, I'll try to streamline the logs next.
And you're right, there isnt any significant usage of the click function's
taskID, it is merely for identifying the ongoing process so that it is clearer
to the dev, which process' ID was being generated, but we can reduce this too
if it is unneccesary. As for the decorator, the task_id = str(uuid.uuid4()) is
being used to identify any concurrent processes being run, so that we can
differentiate ongoing processes per task_id for further debugging as per
https://github.com/apache/incubator-hugegraph-ai/issues/176 . I hope this is
useful for further development and scaling
--
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]