From 99e6d9feb7e4fa03f810e0467fd64f6b234c0e5e Mon Sep 17 00:00:00 2001 From: Adam Nichols Date: Mon, 24 Oct 2022 18:50:37 -0400 Subject: [PATCH 1/2] Log messges --- .../cromwell/filesystems/blob/BlobFileSystemManager.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala b/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala index a3e6f33572a..dde5bf58bda 100644 --- a/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala +++ b/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala @@ -17,6 +17,7 @@ import java.time.{Duration, Instant, OffsetDateTime} import scala.jdk.CollectionConverters._ import scala.util.{Failure, Success, Try} import com.azure.resourcemanager.storage.models.StorageAccountKey +import com.typesafe.scalalogging.LazyLogging case class FileSystemAPI() { def getFileSystem(uri: URI): Try[FileSystem] = Try(FileSystems.getFileSystem(uri)) @@ -44,7 +45,7 @@ case class BlobFileSystemManager( expiryBufferMinutes: Long, blobTokenGenerator: BlobTokenGenerator, fileSystemAPI: FileSystemAPI = FileSystemAPI(), - private val initialExpiration: Option[Instant] = None) { + private val initialExpiration: Option[Instant] = None) extends LazyLogging { private var expiry: Option[Instant] = initialExpiration val buffer: Duration = Duration.of(expiryBufferMinutes, ChronoUnit.MINUTES) @@ -57,10 +58,13 @@ case class BlobFileSystemManager( shouldReopenFilesystem match { case false => fileSystemAPI.getFileSystem(uri).recoverWith { // If no filesystem already exists, this will create a new connection, with the provided configs - case _: FileSystemNotFoundException => blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) + case _: FileSystemNotFoundException => + logger.debug(s"Creating new blob filesystem for URI $uri") + blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) } // If the token has expired, OR there is no token record, try to close the FS and regenerate case true => + logger.debug(s"Closing & regenerating token for existing blob filesystem at URI $uri") fileSystemAPI.closeFileSystem(uri) blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) } From 2634cb7c0610b89e40f9bef44009ecc91ffbce75 Mon Sep 17 00:00:00 2001 From: Adam Nichols Date: Thu, 27 Oct 2022 15:32:13 -0400 Subject: [PATCH 2/2] `DEBUG` -> `INFO` --- .../cromwell/filesystems/blob/BlobFileSystemManager.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala b/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala index dde5bf58bda..3ebce4db878 100644 --- a/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala +++ b/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala @@ -59,12 +59,12 @@ case class BlobFileSystemManager( case false => fileSystemAPI.getFileSystem(uri).recoverWith { // If no filesystem already exists, this will create a new connection, with the provided configs case _: FileSystemNotFoundException => - logger.debug(s"Creating new blob filesystem for URI $uri") + logger.info(s"Creating new blob filesystem for URI $uri") blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) } // If the token has expired, OR there is no token record, try to close the FS and regenerate case true => - logger.debug(s"Closing & regenerating token for existing blob filesystem at URI $uri") + logger.info(s"Closing & regenerating token for existing blob filesystem at URI $uri") fileSystemAPI.closeFileSystem(uri) blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) }