[GitHub] [openwhisk] ningyougang edited a comment on pull request #5102: [New Scheduler] Implement FunctionPullingContainerPool

2021-05-05 Thread GitBox


ningyougang edited a comment on pull request #5102:
URL: https://github.com/apache/openwhisk/pull/5102#issuecomment-833230660


   @bdoyle0182 @style95 it is ready to review again now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [openwhisk] ningyougang commented on pull request #5102: [New Scheduler] Implement FunctionPullingContainerPool

2021-05-05 Thread GitBox


ningyougang commented on pull request #5102:
URL: https://github.com/apache/openwhisk/pull/5102#issuecomment-833230660


   @bdoyle0182 @style95 it is ready to review now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [openwhisk] ningyougang commented on a change in pull request #5102: [New Scheduler] Implement FunctionPullingContainerPool

2021-05-05 Thread GitBox


ningyougang commented on a change in pull request #5102:
URL: https://github.com/apache/openwhisk/pull/5102#discussion_r627083252



##
File path: 
core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/FunctionPullingContainerPool.scala
##
@@ -0,0 +1,857 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openwhisk.core.containerpool.v2
+
+import java.util.concurrent.atomic.AtomicInteger
+
+import akka.actor.{Actor, ActorRef, ActorRefFactory, Cancellable, Props}
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.openwhisk.common._
+import org.apache.openwhisk.core.connector.ContainerCreationError._
+import org.apache.openwhisk.core.connector.{
+  ContainerCreationAckMessage,
+  ContainerCreationMessage,
+  ContainerDeletionMessage
+}
+import org.apache.openwhisk.core.containerpool.{
+  AdjustPrewarmedContainer,
+  BlackboxStartupError,
+  ColdStartKey,
+  ContainerPool,
+  ContainerPoolConfig,
+  ContainerRemoved,
+  PrewarmingConfig,
+  WhiskContainerStartupError
+}
+import org.apache.openwhisk.core.entity._
+import org.apache.openwhisk.core.entity.size._
+import org.apache.openwhisk.http.Messages
+
+import scala.annotation.tailrec
+import scala.collection.concurrent.TrieMap
+import scala.collection.immutable
+import scala.concurrent.Future
+import scala.concurrent.duration._
+import scala.util.{Random, Try}
+import scala.collection.immutable.Queue
+
+case class CreationContainer(creationMessage: ContainerCreationMessage, 
action: WhiskAction)
+case class DeletionContainer(deletionMessage: ContainerDeletionMessage)
+case object Remove
+case class Keep(timeout: FiniteDuration)
+case class PrewarmContainer(maxConcurrent: Int)
+
+/**
+ * A pool managing containers to run actions on.
+ *
+ * This pool fulfills the other half of the ContainerProxy contract. Only
+ * one job (either Start or Run) is sent to a child-actor at any given
+ * time. The pool then waits for a response of that container, indicating
+ * the container is done with the job. Only then will the pool send another
+ * request to that container.
+ *
+ * Upon actor creation, the pool will start to prewarm containers according
+ * to the provided prewarmConfig, iff set. Those containers will **not** be
+ * part of the poolsize calculation, which is capped by the poolSize parameter.
+ * Prewarm containers are only used, if they have matching arguments
+ * (kind, memory) and there is space in the pool.
+ *
+ * @param childFactory method to create new container proxy actor
+ * @param prewarmConfig optional settings for container prewarming
+ * @param poolConfig config for the ContainerPool
+ */
+class FunctionPullingContainerPool(
+  childFactory: ActorRefFactory => ActorRef,
+  invokerHealthService: ActorRef,
+  poolConfig: ContainerPoolConfig,
+  instance: InvokerInstanceId,
+  prewarmConfig: List[PrewarmingConfig] = List.empty,
+  sendAckToScheduler: (SchedulerInstanceId, ContainerCreationAckMessage) => 
Future[RecordMetadata])(
+  implicit val logging: Logging)
+extends Actor {
+  import ContainerPoolV2.memoryConsumptionOf
+
+  implicit val ec = context.system.dispatcher
+
+  private var busyPool = immutable.Map.empty[ActorRef, Data]
+  private var inProgressPool = immutable.Map.empty[ActorRef, Data]
+  private var warmedPool = immutable.Map.empty[ActorRef, WarmData]
+  private var prewarmedPool = immutable.Map.empty[ActorRef, PreWarmData]
+  private var prewarmStartingPool = immutable.Map.empty[ActorRef, (String, 
ByteSize)]
+
+  private var shuttingDown = false
+
+  private val creationMessages = TrieMap[ActorRef, ContainerCreationMessage]()
+
+  private var preWarmScheduler: Option[Cancellable] = None
+  private var prewarmConfigQueue = Queue.empty[(CodeExec[_], ByteSize, 
Option[FiniteDuration])]
+  private val prewarmCreateFailedCount = new AtomicInteger(0)
+
+  val logScheduler = context.system.scheduler.schedule(0.seconds, 1.seconds) {
+MetricEmitter.emitHistogramMetric(
+  LoggingMarkers.INVOKER_CONTAINERPOOL_MEMORY("inprogress"),
+  memoryConsumptionOf(inProgressPool))
+MetricEmitter.emitHistogramMetric(
+  LoggingMarkers.INVOKER_CONTAINERPOOL_MEMORY("busy"),
+  

[GitHub] [openwhisk] codecov-commenter edited a comment on pull request #5062: Add prefix for topics

2021-05-05 Thread GitBox


codecov-commenter edited a comment on pull request #5062:
URL: https://github.com/apache/openwhisk/pull/5062#issuecomment-828178673


   # 
[Codecov](https://codecov.io/gh/apache/openwhisk/pull/5062?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#5062](https://codecov.io/gh/apache/openwhisk/pull/5062?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (1b73098) into 
[master](https://codecov.io/gh/apache/openwhisk/commit/f7ec9e30d2de3f0c3252e32b300d4aa7412b15bf?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (f7ec9e3) will **increase** coverage by `35.84%`.
   > The diff coverage is `53.33%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/openwhisk/pull/5062/graphs/tree.svg?width=650=150=pr=l0YmsiSAso_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/openwhisk/pull/5062?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   
   ```diff
   @@ Coverage Diff @@
   ##   master#5062   +/-   ##
   ===
   + Coverage   38.79%   74.63%   +35.84% 
   ===
 Files 218  220+2 
 Lines   1070010822  +122 
 Branches  454  445-9 
   ===
   + Hits 4151 8077 +3926 
   + Misses   6549 2745 -3804 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/openwhisk/pull/5062?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[...rg/apache/openwhisk/core/scheduler/Scheduler.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29yZS9zY2hlZHVsZXIvc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9vcGVud2hpc2svY29yZS9zY2hlZHVsZXIvU2NoZWR1bGVyLnNjYWxh)
 | `0.00% <0.00%> (ø)` | |
   | 
[.../apache/openwhisk/core/controller/Controller.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29yZS9jb250cm9sbGVyL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvY29udHJvbGxlci9Db250cm9sbGVyLnNjYWxh)
 | `55.66% <33.33%> (+55.66%)` | :arrow_up: |
   | 
[...scala/org/apache/openwhisk/common/UserEvents.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvbW1vbi9Vc2VyRXZlbnRzLnNjYWxh)
 | `75.00% <50.00%> (+8.33%)` | :arrow_up: |
   | 
[...la/org/apache/openwhisk/core/invoker/Invoker.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29yZS9pbnZva2VyL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvaW52b2tlci9JbnZva2VyLnNjYWxh)
 | `46.93% <66.66%> (-22.91%)` | :arrow_down: |
   | 
[.../scala/org/apache/openwhisk/core/WhiskConfig.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvV2hpc2tDb25maWcuc2NhbGE=)
 | `95.54% <100.00%> (+0.05%)` | :arrow_up: |
   | 
[...apache/openwhisk/core/ack/MessagingActiveAck.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvYWNrL01lc3NhZ2luZ0FjdGl2ZUFjay5zY2FsYQ==)
 | `58.33% <100.00%> (+3.78%)` | :arrow_up: |
   | 
[...nwhisk/core/database/RemoteCacheInvalidation.scala](https://codecov.io/gh/apache/openwhisk/pull/5062/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvUmVtb3RlQ2FjaGVJbnZhbGlkYXRpb24uc2NhbGE=)
 | `80.64% <100.00%> (+0.64%)` | :arrow_up: |
   | 

[GitHub] [openwhisk] upgle commented on pull request #4986: Implement action versioning

2021-05-05 Thread GitBox


upgle commented on pull request #4986:
URL: https://github.com/apache/openwhisk/pull/4986#issuecomment-833190133


   @jiangpengcheng please resolve conflicts


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [openwhisk] jiangpengcheng merged pull request #5098: [New Scheduler]Implement PFCInvokerServer

2021-05-05 Thread GitBox


jiangpengcheng merged pull request #5098:
URL: https://github.com/apache/openwhisk/pull/5098


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org