pyblish-base
pyblish-base copied to clipboard
Visualise time-per-plugin
This was a suggestion by @davidmartinezanim
Time is currently logged at the end of a completed publish. However, when a single plug-in is taking longer than usual, it can be helpful to visualise how long it took to pin-point exactly which plug-in it was causing the delay.
It would be visually nice to have something like this:
ValidateNamingConvention... (0.24)
ValidateMutedChannels... (0.01)
But as we can't know how long it took until it's finished, we'll have to delay it. Maybe something like this.
ValidateNamingConvention...
# INFO Time taken 0.23
ValidateMutedChannels...
# INFO Time taken 0.01
ValidateFileSources...
# INFO Processing instance: "character_SEL"
# INFO Time taken 0.84
But it could be distracting when plug-ins that didn't really do much to still provide timing information. So an alternative could be this.
ValidateNamingConvention...
# DEBUG Time taken 0.23
ValidateMutedChannels...
# DEBUG Time taken 0.01
ValidateFileSources...
# INFO Processing instance: "character_SEL"
# DEBUG Time taken 0.84
This way, the time is only visible when running a publish with debug logging.
import pyblish.main
pyblish.main.publish(logging_level=logging.DEBUG)