This is an automated email from the ASF dual-hosted git repository. style95 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwhisk.git
The following commit(s) were added to refs/heads/master by this push: new ba871e59f Apply scalaFmt (#5415) ba871e59f is described below commit ba871e59f7b77f02689a13e4e24e438645d67a47 Author: Dominic Kim <styl...@apache.org> AuthorDate: Sat May 20 12:56:37 2023 +0900 Apply scalaFmt (#5415) --- .../openwhisk/core/entity/InstanceConcurrencyLimit.scala | 2 +- .../openwhisk/core/entity/IntraConcurrencyLimit.scala | 2 +- .../org/apache/openwhisk/core/controller/Limits.scala | 5 ++--- .../apache/openwhisk/core/loadBalancer/LeanBalancer.scala | 3 ++- .../scala/org/apache/openwhisk/core/invoker/Invoker.scala | 14 ++++++++------ .../apache/openwhisk/core/invoker/InvokerReactive.scala | 5 ++--- .../org/apache/openwhisk/standalone/KafkaLauncher.scala | 4 ++-- .../openwhisk/core/controller/test/ActionsApiTests.scala | 8 +------- .../openwhisk/core/controller/test/LimitsApiTests.scala | 9 ++++++++- .../database/cosmosdb/cache/CacheInvalidatorTests.scala | 10 +++++++++- .../apache/openwhisk/core/limits/ActionLimitsTests.scala | 6 +++--- 11 files changed, 39 insertions(+), 29 deletions(-) diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceConcurrencyLimit.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceConcurrencyLimit.scala index c6edc88c1..c027d25cb 100644 --- a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceConcurrencyLimit.scala +++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/InstanceConcurrencyLimit.scala @@ -39,7 +39,7 @@ import spray.json._ * * @param maxConcurrentInstances the max number of concurrent activations in a single container */ -protected[entity] class InstanceConcurrencyLimit private(val maxConcurrentInstances: Int) extends AnyVal +protected[entity] class InstanceConcurrencyLimit private (val maxConcurrentInstances: Int) extends AnyVal protected[core] object InstanceConcurrencyLimit extends ArgNormalizer[InstanceConcurrencyLimit] { diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/IntraConcurrencyLimit.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/IntraConcurrencyLimit.scala index ccf553479..f34d810c0 100644 --- a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/IntraConcurrencyLimit.scala +++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/IntraConcurrencyLimit.scala @@ -42,7 +42,7 @@ case class IntraConcurrencyLimitConfig(min: Int, max: Int, std: Int) * * @param maxConcurrent the max number of concurrent activations in a single container */ -protected[entity] class IntraConcurrencyLimit private(val maxConcurrent: Int) extends AnyVal { +protected[entity] class IntraConcurrencyLimit private (val maxConcurrent: Int) extends AnyVal { /** It checks the namespace memory limit setting value */ @throws[ActionConcurrencyLimitException] diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Limits.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Limits.scala index d621bc657..0d54e7339 100644 --- a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Limits.scala +++ b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Limits.scala @@ -24,7 +24,7 @@ import org.apache.openwhisk.common.TransactionId import org.apache.openwhisk.core.WhiskConfig import org.apache.openwhisk.core.entitlement.{Collection, Privilege, Resource} import org.apache.openwhisk.core.entitlement.Privilege.READ -import org.apache.openwhisk.core.entity.{IntraConcurrencyLimit, Identity, LogLimit, MemoryLimit, TimeLimit} +import org.apache.openwhisk.core.entity.{Identity, IntraConcurrencyLimit, LogLimit, MemoryLimit, TimeLimit} trait WhiskLimitsApi extends Directives with AuthenticatedRouteProvider with AuthorizedRouteProvider { @@ -65,8 +65,7 @@ trait WhiskLimitsApi extends Directives with AuthenticatedRouteProvider with Aut maxActionConcurrency = Some(IntraConcurrencyLimit(user.limits.allowedMaxActionConcurrency)), minActionConcurrency = Some(IntraConcurrencyLimit(user.limits.allowedMinActionConcurrency)), maxParameterSize = Some(user.limits.allowedMaxParameterSize), - maxActionInstances = - Some(user.limits.concurrentInvocations.getOrElse(concurrentInvocationsSystemDefault))) + maxActionInstances = Some(user.limits.concurrentInvocations.getOrElse(concurrentInvocationsSystemDefault))) pathEndOrSingleSlash { complete(OK, limits) } case _ => reject //should never get here } diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/LeanBalancer.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/LeanBalancer.scala index c1688ac83..161ee148e 100644 --- a/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/LeanBalancer.scala +++ b/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/LeanBalancer.scala @@ -67,7 +67,8 @@ class LeanBalancer(config: WhiskConfig, /** Creates an invoker for executing user actions. There is only one invoker in the lean model. */ private def makeALocalThreadedInvoker(): Unit = { implicit val ec = ExecutionContextFactory.makeCachedThreadPoolExecutionContext() - val limitConfig: IntraConcurrencyLimitConfig = loadConfigOrThrow[IntraConcurrencyLimitConfig](ConfigKeys.concurrencyLimit) + val limitConfig: IntraConcurrencyLimitConfig = + loadConfigOrThrow[IntraConcurrencyLimitConfig](ConfigKeys.concurrencyLimit) SpiLoader.get[InvokerProvider].instance(config, invokerName, messageProducer, poolConfig, limitConfig) } diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala index 592809728..1d31175c1 100644 --- a/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala +++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala @@ -107,7 +107,8 @@ object Invoker { ActorSystem(name = "invoker-actor-system", defaultExecutionContext = Some(ec)) implicit val logger = new AkkaLogging(akka.event.Logging.getLogger(actorSystem, this)) val poolConfig: ContainerPoolConfig = loadConfigOrThrow[ContainerPoolConfig](ConfigKeys.containerPool) - val limitConfig: IntraConcurrencyLimitConfig = loadConfigOrThrow[IntraConcurrencyLimitConfig](ConfigKeys.concurrencyLimit) + val limitConfig: IntraConcurrencyLimitConfig = + loadConfigOrThrow[IntraConcurrencyLimitConfig](ConfigKeys.concurrencyLimit) val tags: Seq[String] = Some(loadConfigOrThrow[String](ConfigKeys.invokerResourceTags)) .map(_.trim()) .filter(_ != "") @@ -236,11 +237,12 @@ object Invoker { * An Spi for providing invoker implementation. */ trait InvokerProvider extends Spi { - def instance(config: WhiskConfig, - instance: InvokerInstanceId, - producer: MessageProducer, - poolConfig: ContainerPoolConfig, - limitsConfig: IntraConcurrencyLimitConfig)(implicit actorSystem: ActorSystem, logging: Logging): InvokerCore + def instance( + config: WhiskConfig, + instance: InvokerInstanceId, + producer: MessageProducer, + poolConfig: ContainerPoolConfig, + limitsConfig: IntraConcurrencyLimitConfig)(implicit actorSystem: ActorSystem, logging: Logging): InvokerCore } // this trait can be used to add common implementation diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala index 17d9c9bb8..ab265d051 100644 --- a/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala +++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala @@ -59,9 +59,8 @@ class InvokerReactive( instance: InvokerInstanceId, producer: MessageProducer, poolConfig: ContainerPoolConfig = loadConfigOrThrow[ContainerPoolConfig](ConfigKeys.containerPool), - limitsConfig: IntraConcurrencyLimitConfig = loadConfigOrThrow[IntraConcurrencyLimitConfig](ConfigKeys.concurrencyLimit))( - implicit actorSystem: ActorSystem, - logging: Logging) + limitsConfig: IntraConcurrencyLimitConfig = loadConfigOrThrow[IntraConcurrencyLimitConfig]( + ConfigKeys.concurrencyLimit))(implicit actorSystem: ActorSystem, logging: Logging) extends InvokerCore { implicit val ec: ExecutionContext = actorSystem.dispatcher diff --git a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/KafkaLauncher.scala b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/KafkaLauncher.scala index 41e91e4a0..a7be4abea 100644 --- a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/KafkaLauncher.scala +++ b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/KafkaLauncher.scala @@ -68,8 +68,8 @@ class KafkaLauncher( val t = Try { createDir("zookeeper") createDir("kafka") - EmbeddedKafka.startZooKeeper(FileSystems.getDefault.getPath(workDir.getPath,"zookeeper")) - EmbeddedKafka.startKafka(FileSystems.getDefault.getPath(workDir.getPath,"kafka")) + EmbeddedKafka.startZooKeeper(FileSystems.getDefault.getPath(workDir.getPath, "zookeeper")) + EmbeddedKafka.startKafka(FileSystems.getDefault.getPath(workDir.getPath, "kafka")) } Future diff --git a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala index ef6d8d36a..82ffe82b3 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala @@ -955,13 +955,7 @@ class ActionsApiTests extends ControllerTestCommon with WhiskActionsApi { val content = WhiskActionPut( Some(jsDefault("_")), Some(Parameters("x", "X")), - Some( - ActionLimitsOption( - None, - None, - None, - None, - Some(InstanceConcurrencyLimit(40))))) + Some(ActionLimitsOption(None, None, None, None, Some(InstanceConcurrencyLimit(40))))) Put(s"$collectionPath/${aname()}", content) ~> Route.seal(routes(credsWithNamespaceLimits)) ~> check { status should be(BadRequest) diff --git a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/LimitsApiTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/LimitsApiTests.scala index 2d6692980..1b2f46e2d 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/LimitsApiTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/LimitsApiTests.scala @@ -23,7 +23,14 @@ import akka.http.scaladsl.model.StatusCodes.{BadRequest, MethodNotAllowed, OK} import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport.sprayJsonUnmarshaller import akka.http.scaladsl.server.Route import org.apache.openwhisk.core.controller.WhiskLimitsApi -import org.apache.openwhisk.core.entity.{IntraConcurrencyLimit, EntityPath, LogLimit, MemoryLimit, TimeLimit, UserLimits} +import org.apache.openwhisk.core.entity.{ + EntityPath, + IntraConcurrencyLimit, + LogLimit, + MemoryLimit, + TimeLimit, + UserLimits +} import org.apache.openwhisk.core.entity.size._ import scala.concurrent.duration._ diff --git a/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/cache/CacheInvalidatorTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/cache/CacheInvalidatorTests.scala index a40ed64df..936f483c6 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/cache/CacheInvalidatorTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/cache/CacheInvalidatorTests.scala @@ -27,7 +27,15 @@ import org.apache.kafka.common.serialization.StringDeserializer import org.apache.openwhisk.common.{AkkaLogging, TransactionId} import org.apache.openwhisk.core.database.{CacheInvalidationMessage, RemoteCacheInvalidation} import org.apache.openwhisk.core.database.cosmosdb.{CosmosDBArtifactStoreProvider, CosmosDBTestSupport} -import org.apache.openwhisk.core.entity.{DocumentReader, EntityName, EntityPath, WhiskDocumentReader, WhiskEntity, WhiskEntityJsonFormat, WhiskPackage} +import org.apache.openwhisk.core.entity.{ + DocumentReader, + EntityName, + EntityPath, + WhiskDocumentReader, + WhiskEntity, + WhiskEntityJsonFormat, + WhiskPackage +} import org.junit.runner.RunWith import org.scalatest.concurrent.ScalaFutures import org.scalatest.junit.JUnitRunner diff --git a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala index e35b9ec0d..7fe757428 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala @@ -43,8 +43,8 @@ import org.apache.openwhisk.core.entity.{ ActivationEntityLimit, ActivationResponse, ByteSize, - IntraConcurrencyLimit, Exec, + IntraConcurrencyLimit, LogLimit, MemoryLimit, TimeLimit @@ -125,13 +125,13 @@ class ActionLimitsTests extends TestHelpers with WskTestHelpers with WskActorSys case Some(l) => s"${l} (allowed)" } val toConcurrencyString = concurrency match { - case None => "None" + case None => "None" case Some(IntraConcurrencyLimit.MIN_CONCURRENT) => s"${IntraConcurrencyLimit.MIN_CONCURRENT} (= min)" case Some(IntraConcurrencyLimit.STD_CONCURRENT) => s"${IntraConcurrencyLimit.STD_CONCURRENT} (= std)" case Some(IntraConcurrencyLimit.MAX_CONCURRENT) => s"${IntraConcurrencyLimit.MAX_CONCURRENT} (= max)" case Some(c) if (c < IntraConcurrencyLimit.MIN_CONCURRENT) => s"${c} (< min)" case Some(c) if (c > IntraConcurrencyLimit.MAX_CONCURRENT) => s"${c} (> max)" - case Some(c) => s"${c} (allowed)" + case Some(c) => s"${c} (allowed)" } val toExpectedResultString: String = if (ec == SUCCESS_EXIT) "allow" else "reject" }