From 2abfbdaadded0eff17ee0e5ea1908758e6d7a222 Mon Sep 17 00:00:00 2001 From: Mark Hamilton Date: Wed, 18 Oct 2023 14:58:09 -0400 Subject: [PATCH] fix: fix small bug in timing logic (#2099) --- .../azure/synapse/ml/logging/SynapseMLLogging.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/scala/com/microsoft/azure/synapse/ml/logging/SynapseMLLogging.scala b/core/src/main/scala/com/microsoft/azure/synapse/ml/logging/SynapseMLLogging.scala index 4cab7a971b..f5fe72c4db 100644 --- a/core/src/main/scala/com/microsoft/azure/synapse/ml/logging/SynapseMLLogging.scala +++ b/core/src/main/scala/com/microsoft/azure/synapse/ml/logging/SynapseMLLogging.scala @@ -150,19 +150,19 @@ trait SynapseMLLogging extends Logging { } def logFit[T](f: => T, columns: Int, logCertifiedEvent: Boolean = true): T = { - logVerb("fit", f, columns, logCertifiedEvent) + logVerb("fit", f, Some(columns), logCertifiedEvent) } def logTransform[T](f: => T, columns: Int, logCertifiedEvent: Boolean = true): T = { - logVerb("transform", f, columns, logCertifiedEvent) + logVerb("transform", f, Some(columns), logCertifiedEvent) } - def logVerb[T](verb: String, f: => T, columns: Int = -1, logCertifiedEvent: Boolean = false): T = { + def logVerb[T](verb: String, f: => T, columns: Option[Int] = None, logCertifiedEvent: Boolean = false): T = { val startTime = System.nanoTime() try { - // Begin emitting certified event. - logBase(verb, Some(columns), Some((System.nanoTime() - startTime) / 1e9), logCertifiedEvent) - f + val ret = f + logBase(verb, columns, Some((System.nanoTime() - startTime) / 1e9), logCertifiedEvent) + ret } catch { case e: Exception => logErrorBase(verb, e)