-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log manager for Python based nodes #631
Log manager for Python based nodes #631
Conversation
Latest Changes
also fix error not returning proper information (chunk.node.inputFiles.value - > [i.value for i in chunk.node.inputFiles.value])
Hi @ChemicalXandco , In term of implementation, it would be nice if we could rely on a standard logging object. It would be good also to expose a verbose level parameter on the node, as on the C++ nodes. |
meshroom/core/node.py
Outdated
@@ -142,6 +237,7 @@ def __init__(self, node, range, parent=None): | |||
super(NodeChunk, self).__init__(parent) | |||
self.node = node | |||
self.range = range | |||
self.log = LogManager(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, node, range, parent=None):
...
self.logManager = LogManager(self)
...
@property
def logging(self):
return self.logManager.logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have called the property logger
instead of logging
because it makes more sense imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I agree.
shutil.copyfile(iFile, oFile) | ||
print('Publish end') | ||
chunk.log.add('Publish end') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chunk.logging.info('Publish end')
also allow progress bar to be used even while messages are added
@ChemicalXandco a stupid question, it seems that your logManager class is used for python based nodes only, how about CLI based node? Is it suitable to use your class for log implementtation in my own CLI nodes? And could you tell me somthing about how do nodes like "Texturing" in meshroom handle the log message.Thanks. |
@TigerVersusT The C++ side of the software (AliceVision framework) uses it's own logging system. By 'CLI based node', I'm assuming you mean an executable file not from the AliceVision framework. In that case, the best approach imo would be to forward the messages from stdout of the process to the logger implemented here. |
@ChemicalXandco Thanks for your help! |
Description
There is currently no easy way for nodes that are executed in python to use the log file, this system makes adding a message as simple as
chunk.logger.info('message')
, currently the Publish node usesprint()
but this is not very helpful because it is not stored in a file that can be viewed afterwards.becomes
Features list
boost::progress_display
within LogManagerImplementation remarks
I do welcome feedback because I am not sure if this is the best way to implement this.