Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
ehigham committed Oct 16, 2024
1 parent 85d7662 commit 5b8a35b
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 52 deletions.
5 changes: 3 additions & 2 deletions hail/src/main/scala/is/hail/backend/BackendServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import is.hail.expr.ir.{IRParser, IRParserEnvironment}
import is.hail.utils._

import scala.util.control.NonFatal

import java.io.Closeable
import java.net.InetSocketAddress
import java.nio.charset.StandardCharsets
import java.util.concurrent._

import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer}
import org.json4s._
import org.json4s.jackson.JsonMethods
import org.json4s.jackson.JsonMethods.compact

import java.io.Closeable

case class IRTypePayload(ir: String)
case class LoadReferencesFromDatasetPayload(path: String)

Expand Down
14 changes: 9 additions & 5 deletions hail/src/main/scala/is/hail/backend/service/ServiceBackend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import is.hail.annotations._
import is.hail.asm4s._
import is.hail.backend._
import is.hail.expr.Validate
import is.hail.expr.ir.{Compile, IR, IRParser, IRParserEnvironment, IRSize, LoweringAnalyses, MakeTuple, SortField, TableIR, TableReader, TypeCheck}
import is.hail.expr.ir.{
Compile, IR, IRParser, IRParserEnvironment, IRSize, LoweringAnalyses, MakeTuple, SortField,
TableIR, TableReader, TypeCheck,
}
import is.hail.expr.ir.analyses.SemanticHash
import is.hail.expr.ir.functions.IRFunctionRegistry
import is.hail.expr.ir.lowering._
import is.hail.io.fs._
import is.hail.linalg.BlockMatrix
import is.hail.services.JobGroupStates.Failure
import is.hail.services.{BatchClient, _}
import is.hail.services.JobGroupStates.Failure
import is.hail.types._
import is.hail.types.physical._
import is.hail.types.physical.stypes.PTypeReferenceSingleCodeType
Expand All @@ -22,17 +25,18 @@ import is.hail.variant.ReferenceGenome

import scala.annotation.switch
import scala.reflect.ClassTag

import java.io._
import java.nio.charset.StandardCharsets
import java.nio.file.Path
import java.util.concurrent._

import org.apache.log4j.Logger
import org.json4s.{DefaultFormats, Formats}
import org.json4s.JsonAST._
import org.json4s.jackson.JsonMethods
import sourcecode.Enclosing

import java.nio.file.Path

class ServiceBackendContext(
val billingProject: String,
val remoteTmpDir: String,
Expand Down Expand Up @@ -181,7 +185,7 @@ class ServiceBackend(
val uploadContexts = executor.submit[Unit](() =>
retryTransientErrors {
fs.writePDOS(s"$root/contexts") { os =>
var o = 12L * n // 12L = sizeof(Long) + sizeof(Int)
var o = 12L * n // 12L = sizeof(Long) + sizeof(Int)
collection.foreach { context =>
val len = context.length
os.writeLong(o)
Expand Down
14 changes: 8 additions & 6 deletions hail/src/main/scala/is/hail/backend/service/Worker.scala
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package is.hail.backend.service

import is.hail.{HAIL_REVISION, HailContext, HailFeatureFlags}
import is.hail.asm4s._
import is.hail.backend.HailTaskContext
import is.hail.io.fs._
import is.hail.services._
import is.hail.utils._
import is.hail.{HAIL_REVISION, HailContext, HailFeatureFlags}
import org.apache.log4j.Logger

import scala.collection.mutable
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.duration.Duration
import scala.util.control.NonFatal

import java.io._
import java.nio.charset._
import java.nio.file.Path
import java.util
import java.util.{concurrent => javaConcurrent}
import scala.collection.mutable
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.util.control.NonFatal

import org.apache.log4j.Logger

class ServiceTaskContext(val partitionId: Int) extends HailTaskContext {
override def stageId(): Int = 0
Expand Down
14 changes: 7 additions & 7 deletions hail/src/main/scala/is/hail/io/fs/AzureStorageFS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import is.hail.services.oauth2.AzureCloudCredentials
import is.hail.services.retryTransientErrors
import is.hail.shadedazure.com.azure.core.credential.AzureSasCredential
import is.hail.shadedazure.com.azure.core.util.HttpClientOptions
import is.hail.shadedazure.com.azure.storage.blob.{
BlobClient, BlobContainerClient, BlobServiceClient, BlobServiceClientBuilder,
}
import is.hail.shadedazure.com.azure.storage.blob.models.{
BlobItem, BlobRange, BlobStorageException, ListBlobsOptions,
}
import is.hail.shadedazure.com.azure.storage.blob.specialized.BlockBlobClient
import is.hail.shadedazure.com.azure.storage.blob.{
BlobClient, BlobContainerClient, BlobServiceClient, BlobServiceClientBuilder,
}

import java.io.{ByteArrayOutputStream, FileNotFoundException, OutputStream}
import java.nio.file.Paths
import java.time.Duration
import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import java.nio.file.Path

import java.io.{ByteArrayOutputStream, FileNotFoundException, OutputStream}
import java.nio.file.{Path, Paths}
import java.time.Duration

class AzureStorageFSURL(
val account: String,
Expand Down
3 changes: 2 additions & 1 deletion hail/src/main/scala/is/hail/io/fs/FS.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package is.hail.io.fs


import is.hail.HailContext
import is.hail.backend.BroadcastValue
import is.hail.io.compress.{BGzipInputStream, BGzipOutputStream}
Expand All @@ -10,10 +9,12 @@ import is.hail.utils._

import scala.collection.mutable
import scala.io.Source

import java.io._
import java.nio.ByteBuffer
import java.nio.file.FileSystems
import java.util.zip.GZIPOutputStream

import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
import org.apache.commons.io.IOUtils
import org.apache.hadoop
Expand Down
22 changes: 13 additions & 9 deletions hail/src/main/scala/is/hail/io/fs/GoogleStorageFS.scala
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
package is.hail.io.fs

import com.google.api.client.googleapis.json.GoogleJsonResponseException
import com.google.cloud.http.HttpTransportOptions
import com.google.cloud.storage.Storage.{BlobGetOption, BlobListOption, BlobSourceOption, BlobWriteOption}
import com.google.cloud.storage.{Option => _, _}
import com.google.cloud.{ReadChannel, WriteChannel}
import is.hail.HailFeatureFlags
import is.hail.io.fs.FSUtil.dropTrailingSlash
import is.hail.io.fs.GoogleStorageFS.RequesterPaysFailure
import is.hail.services.oauth2.GoogleCloudCredentials
import is.hail.services.{isTransientError, retryTransientErrors}
import is.hail.services.oauth2.GoogleCloudCredentials
import is.hail.utils._

import scala.jdk.CollectionConverters._

import java.io.{FileNotFoundException, IOException}
import java.nio.ByteBuffer
import java.nio.file.{Path, Paths}
import scala.jdk.CollectionConverters._

import com.google.api.client.googleapis.json.GoogleJsonResponseException
import com.google.cloud.{ReadChannel, WriteChannel}
import com.google.cloud.http.HttpTransportOptions
import com.google.cloud.storage.{Option => _, _}
import com.google.cloud.storage.Storage.{
BlobGetOption, BlobListOption, BlobSourceOption, BlobWriteOption,
}

case class GoogleStorageFSURL(bucket: String, path: String) extends FSURL {
def addPathComponent(c: String): GoogleStorageFSURL =
Expand Down Expand Up @@ -70,13 +74,13 @@ object GoogleStorageFS {
case exc: StorageException =>
Option(exc.getMessage).exists { message =>
message == "userProjectMissing" ||
(exc.getCode == 400 && message.contains("requester pays"))
(exc.getCode == 400 && message.contains("requester pays"))
}

case exc: GoogleJsonResponseException =>
Option(exc.getMessage).exists { message =>
message == "userProjectMissing" ||
(exc.getStatusCode == 400 && message.contains("requester pays"))
(exc.getStatusCode == 400 && message.contains("requester pays"))
}

case _ =>
Expand Down
3 changes: 2 additions & 1 deletion hail/src/main/scala/is/hail/io/fs/RouterFS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package is.hail.io.fs
import is.hail.HailFeatureFlags
import is.hail.services.oauth2.{AzureCloudCredentials, GoogleCloudCredentials}
import is.hail.utils.{FastSeq, SerializableHadoopConfiguration}
import org.apache.hadoop.conf.Configuration

import java.io.Serializable
import java.nio.file.Path

import org.apache.hadoop.conf.Configuration

object RouterFSURL {
def apply(fs: FS)(_url: fs.URL): RouterFSURL = RouterFSURL(_url, fs)
}
Expand Down
7 changes: 4 additions & 3 deletions hail/src/main/scala/is/hail/io/fs/TerraAzureStorageFS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package is.hail.io.fs
import is.hail.services.oauth2.AzureCloudCredentials
import is.hail.shadedazure.com.azure.storage.blob.BlobServiceClient
import is.hail.utils._

import scala.collection.mutable

import org.apache.http.client.methods.HttpPost
import org.apache.http.client.utils.URIBuilder
import org.apache.http.impl.client.HttpClients
import org.apache.http.util.EntityUtils
import org.json4s.jackson.JsonMethods
import org.json4s.{DefaultFormats, Formats}

import scala.collection.mutable
import org.json4s.jackson.JsonMethods

object TerraAzureStorageFS {
private val TEN_MINUTES_IN_MS = 10 * 60 * 1000
Expand Down
14 changes: 8 additions & 6 deletions hail/src/main/scala/is/hail/services/BatchClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ package is.hail.services
import is.hail.expr.ir.ByteArrayBuilder
import is.hail.services.requests.{BatchServiceRequester, Requester}
import is.hail.utils._

import scala.util.Random

import java.nio.charset.StandardCharsets
import java.nio.file.Path

import org.apache.http.entity.ByteArrayEntity
import org.apache.http.entity.ContentType.APPLICATION_JSON
import org.json4s.{CustomSerializer, DefaultFormats, Extraction, Formats, JInt, JObject, JString}
import org.json4s.JsonAST.{JArray, JBool}
import org.json4s.jackson.JsonMethods
import org.json4s.{CustomSerializer, DefaultFormats, Extraction, Formats, JInt, JObject, JString}

import java.nio.charset.StandardCharsets
import java.nio.file.Path
import scala.util.Random

case class BatchRequest(
billing_project: String,
Expand Down Expand Up @@ -87,7 +89,7 @@ object JobGroupStates {

object BatchClient {
def apply(deployConfig: DeployConfig, credentialsFile: Path, env: Map[String, String] = sys.env)
: BatchClient =
: BatchClient =
new BatchClient(BatchServiceRequester(deployConfig, credentialsFile, env))
}

Expand Down
5 changes: 3 additions & 2 deletions hail/src/main/scala/is/hail/services/BatchConfig.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package is.hail.services

import is.hail.utils._
import org.json4s._
import org.json4s.jackson.JsonMethods

import java.nio.file.{Files, Path}

import org.json4s._
import org.json4s.jackson.JsonMethods

object BatchConfig {
def fromConfigFile(file: Path): Option[BatchConfig] =
if (!file.toFile.exists()) None
Expand Down
10 changes: 6 additions & 4 deletions hail/src/main/scala/is/hail/services/oauth2.scala
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package is.hail.services

import com.google.auth.oauth2.{GoogleCredentials, ServiceAccountCredentials}
import is.hail.services.oauth2.AzureCloudCredentials.EnvVars.AzureApplicationCredentials
import is.hail.services.oauth2.GoogleCloudCredentials.EnvVars.GoogleApplicationCredentials
import is.hail.shadedazure.com.azure.core.credential.{TokenCredential, TokenRequestContext}
import is.hail.shadedazure.com.azure.identity.{
ClientSecretCredentialBuilder, DefaultAzureCredentialBuilder,
}
import is.hail.utils.{defaultJSONFormats, using}
import org.json4s.Formats
import org.json4s.jackson.JsonMethods

import scala.collection.JavaConverters._

import java.io.Serializable
import java.nio.file.{Files, Path}
import scala.collection.JavaConverters._

import com.google.auth.oauth2.{GoogleCredentials, ServiceAccountCredentials}
import org.json4s.Formats
import org.json4s.jackson.JsonMethods

object oauth2 {

Expand Down
5 changes: 3 additions & 2 deletions hail/src/main/scala/is/hail/services/package.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package is.hail

import is.hail.services.requests.ClientResponseException
import is.hail.shadedazure.com.azure.storage.common.implementation.Constants
import is.hail.utils._

import scala.util.Random

import java.io._
import java.net._

import com.google.api.client.googleapis.json.GoogleJsonResponseException
import com.google.api.client.http.HttpResponseException
import com.google.cloud.storage.StorageException
import is.hail.services.requests.ClientResponseException

import javax.net.ssl.SSLException
import org.apache.http.{ConnectionClosedException, NoHttpResponseException}
import org.apache.http.conn.HttpHostConnectException
Expand Down
9 changes: 5 additions & 4 deletions hail/src/main/scala/is/hail/services/requests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ package is.hail.services

import is.hail.services.oauth2.{CloudCredentials, CloudScopes}
import is.hail.utils.{log, _}

import java.net.URL
import java.nio.file.Path

import org.apache.http.{HttpEntity, HttpEntityEnclosingRequest}
import org.apache.http.client.config.RequestConfig
import org.apache.http.client.methods.{HttpGet, HttpPatch, HttpPost, HttpUriRequest}
import org.apache.http.entity.ContentType.APPLICATION_JSON
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.{CloseableHttpClient, HttpClients}
import org.apache.http.util.EntityUtils
import org.apache.http.{HttpEntity, HttpEntityEnclosingRequest}
import org.json4s.JValue
import org.json4s.JsonAST.JNothing
import org.json4s.jackson.JsonMethods

import java.net.URL
import java.nio.file.Path

object requests {

class ClientResponseException(val status: Int, message: String) extends Exception(message)
Expand Down

0 comments on commit 5b8a35b

Please sign in to comment.