Log time taken of each phase
Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
da336f75f8
commit
b27301641a
@ -14,6 +14,8 @@
|
|||||||
# along with this program; if not, see <https://gnu.org/licenses/>.
|
# along with this program; if not, see <https://gnu.org/licenses/>.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
|
import time
|
||||||
|
|
||||||
from pungi import util
|
from pungi import util
|
||||||
|
|
||||||
@ -58,6 +60,7 @@ class PhaseBase(object):
|
|||||||
self.compose.log_warning("[SKIP ] %s" % self.msg)
|
self.compose.log_warning("[SKIP ] %s" % self.msg)
|
||||||
self.finished = True
|
self.finished = True
|
||||||
return
|
return
|
||||||
|
self._start_time = time.time()
|
||||||
self.compose.log_info("[BEGIN] %s" % self.msg)
|
self.compose.log_info("[BEGIN] %s" % self.msg)
|
||||||
self.compose.notifier.send("phase-start", phase_name=self.name)
|
self.compose.notifier.send("phase-start", phase_name=self.name)
|
||||||
self.run()
|
self.run()
|
||||||
@ -108,6 +111,13 @@ class PhaseBase(object):
|
|||||||
self.pool.stop()
|
self.pool.stop()
|
||||||
self.finished = True
|
self.finished = True
|
||||||
self.compose.log_info("[DONE ] %s" % self.msg)
|
self.compose.log_info("[DONE ] %s" % self.msg)
|
||||||
|
|
||||||
|
if hasattr(self, "_start_time"):
|
||||||
|
self.compose.log_info(
|
||||||
|
"PHASE %s took %d seconds"
|
||||||
|
% (self.name.upper(), math.ceil(time.time() - self._start_time))
|
||||||
|
)
|
||||||
|
|
||||||
if self.used_patterns is not None:
|
if self.used_patterns is not None:
|
||||||
# We only want to report this if the config was actually queried.
|
# We only want to report this if the config was actually queried.
|
||||||
self.report_unused_patterns()
|
self.report_unused_patterns()
|
||||||
|
Loading…
Reference in New Issue
Block a user