diff --git a/hail/src/main/scala/is/hail/backend/api/Py4JBackendApi.scala b/hail/src/main/scala/is/hail/backend/api/Py4JBackendApi.scala index 3e695dac9181..216d55154a18 100644 --- a/hail/src/main/scala/is/hail/backend/api/Py4JBackendApi.scala +++ b/hail/src/main/scala/is/hail/backend/api/Py4JBackendApi.scala @@ -38,6 +38,7 @@ import org.json4s.jackson.{JsonMethods, Serialization} import sourcecode.Enclosing import javax.annotation.Nullable +import scala.annotation.nowarn final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandling { @@ -92,9 +93,14 @@ final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandlin val cloudfsConf = CloudStorageFSConfig.fromFlagsAndEnv(None, flags) val rpConfig: Option[RequesterPaysConfig] = - (Option(project).filter(_.nonEmpty), Option(buckets)) match { - case (Some(project), buckets) => Some(RequesterPaysConfig(project, buckets.map(_.asScala.toSet))) - case (None, Some(_)) => fatal("A non-empty, non-null requester pays google project is required to configure requester pays buckets.") + ( + Option(project).filter(_.nonEmpty), + Option(buckets).map(_.asScala.toSet.filterNot(_.isBlank)).filter(_.nonEmpty), + ) match { + case (Some(project), buckets) => Some(RequesterPaysConfig(project, buckets)) + case (None, Some(_)) => fatal( + "A non-empty, non-null requester pays google project is required to configure requester pays buckets." + ) case (None, None) => None } @@ -115,7 +121,9 @@ final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandlin persistedIr.remove(id) def pyAddSequence(name: String, fastaFile: String, indexFile: String): Unit = - references(name).addSequence(IndexedFastaSequenceFile(tmpFileManager.getFs, fastaFile, indexFile)) + references(name).addSequence( + IndexedFastaSequenceFile(tmpFileManager.getFs, fastaFile, indexFile) + ) def pyRemoveSequence(name: String): Unit = references(name).removeSequence() @@ -440,7 +448,7 @@ final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandlin t } - def port: Int = httpServer.getAddress.getPort + @nowarn def port: Int = httpServer.getAddress.getPort override def close(): Unit = httpServer.stop(10) thread.start() diff --git a/hail/src/main/scala/is/hail/utils/package.scala b/hail/src/main/scala/is/hail/utils/package.scala index 05d1d0932b45..4fc2acbaf268 100644 --- a/hail/src/main/scala/is/hail/utils/package.scala +++ b/hail/src/main/scala/is/hail/utils/package.scala @@ -91,6 +91,24 @@ package utils { b.result() } } + + + class Lazy[A] private[utils] (f: => A) { + private[this] var option: Option[A] = None + + def apply(): A = + synchronized { + option match { + case Some(a) => a + case None => val a = f; option = Some(a); a + } + } + + def isEvaluated: Boolean = + synchronized { + option.isDefined + } + } } package object utils @@ -1058,23 +1076,6 @@ package object utils implicit def evalLazy[A](f: Lazy[A]): A = f() - - class Lazy[A] private[utils] (f: => A) { - private[this] var option: Option[A] = None - - def apply(): A = - synchronized { - option match { - case Some(a) => a - case None => val a = f; option = Some(a); a - } - } - - def isEvaluated: Boolean = - synchronized { - option.isDefined - } - } } class CancellingExecutorService(delegate: ExecutorService) extends AbstractExecutorService {