Skip to content

Commit d92b788

Browse files
committed
Remove unncessary feature
1 parent 95924a4 commit d92b788

File tree

21 files changed

+75
-192
lines changed

21 files changed

+75
-192
lines changed

common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/Container.scala

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,6 @@ trait Container {
135135
transid.failed(this, start, s"initializiation failed with $t")
136136
}
137137
.flatMap { result =>
138-
// if runtime container is shutting down, reschedule the activation message
139-
result.response.right.map { res =>
140-
if (res.shuttingDown) {
141-
throw ContainerHealthError(transid, containerId.asString)
142-
}
143-
}
144-
145138
if (result.ok) {
146139
Future.successful(result.interval)
147140
} else if (result.interval.duration >= timeout) {
@@ -187,13 +180,6 @@ trait Container {
187180
transid.failed(this, start, s"run failed with $t")
188181
}
189182
.map { result =>
190-
// if runtime container is shutting down, reschedule the activation message
191-
result.response.right.map { res =>
192-
if (res.shuttingDown) {
193-
throw ContainerHealthError(transid, containerId.asString)
194-
}
195-
}
196-
197183
val response = if (result.interval.duration >= timeout) {
198184
ActivationResponse.developerError(Messages.timedoutActivation(timeout, false))
199185
} else {

common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerFactory.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,16 @@ trait ContainerFactory {
114114
userProvidedImage: Boolean,
115115
memory: ByteSize,
116116
cpuShares: Int,
117-
action: Option[ExecutableWhiskAction],
118-
resourceTags: Option[List[String]] = None)(implicit config: WhiskConfig, logging: Logging): Future[Container]
117+
action: Option[ExecutableWhiskAction])(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
118+
createContainer(tid, name, actionImage, userProvidedImage, memory, cpuShares)
119+
}
120+
121+
def createContainer(tid: TransactionId,
122+
name: String,
123+
actionImage: ExecManifest.ImageName,
124+
userProvidedImage: Boolean,
125+
memory: ByteSize,
126+
cpuShares: Int)(implicit config: WhiskConfig, logging: Logging): Future[Container]
119127

120128
/** perform any initialization */
121129
def init(): Unit

common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
package org.apache.openwhisk.core.entity
1919

2020
import scala.util.Try
21-
import akka.http.scaladsl.model.StatusCodes.{OK, ServiceUnavailable}
21+
import akka.http.scaladsl.model.StatusCodes.OK
2222
import spray.json._
2323
import spray.json.DefaultJsonProtocol
24-
import org.apache.openwhisk.common.{Logging, TransactionId}
24+
import org.apache.openwhisk.common.Logging
2525
import org.apache.openwhisk.http.Messages._
2626

2727
protected[core] case class ActivationResponse private (statusCode: Int,
@@ -136,10 +136,6 @@ protected[core] object ActivationResponse extends DefaultJsonProtocol {
136136
/** true iff status code is OK (HTTP 200 status code), anything else is considered an error. **/
137137
val okStatus = statusCode == OK.intValue
138138
val ok = okStatus && truncated.isEmpty
139-
140-
/** true iff status code is ServiceUnavailable (HTTP 503 status code) */
141-
val shuttingDown = statusCode == ServiceUnavailable.intValue
142-
143139
override def toString = {
144140
val base = if (okStatus) "ok" else "not ok"
145141
val rest = truncated.map(e => s", truncated ${e.toString}").getOrElse("")
@@ -196,9 +192,8 @@ protected[core] object ActivationResponse extends DefaultJsonProtocol {
196192
* @param response an Option (HTTP Status Code, HTTP response bytes as String)
197193
* @return appropriate ActivationResponse representing run result
198194
*/
199-
protected[core] def processRunResponseContent(
200-
response: Either[ContainerConnectionError, ContainerResponse],
201-
logger: Logging)(implicit id: TransactionId = TransactionId.unknown): ActivationResponse = {
195+
protected[core] def processRunResponseContent(response: Either[ContainerConnectionError, ContainerResponse],
196+
logger: Logging): ActivationResponse = {
202197
response match {
203198
case Right(res @ ContainerResponse(_, str, truncated)) =>
204199
truncated match {
@@ -242,7 +237,6 @@ protected[core] object ActivationResponse extends DefaultJsonProtocol {
242237

243238
case Left(e) =>
244239
// This indicates a terminal failure in the container (it exited prematurely).
245-
logger.error(this, abnormalRun)
246240
developerError(abnormalRun)
247241
}
248242
}

common/scala/src/main/scala/org/apache/openwhisk/core/mesos/MesosContainerFactory.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ import org.apache.openwhisk.common.TransactionId
4545
import org.apache.openwhisk.core.ConfigKeys
4646
import org.apache.openwhisk.core.WhiskConfig
4747
import org.apache.openwhisk.core.containerpool._
48-
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest, ExecutableWhiskAction, InvokerInstanceId, UUID}
48+
import org.apache.openwhisk.core.entity.ByteSize
49+
import org.apache.openwhisk.core.entity.ExecManifest
50+
import org.apache.openwhisk.core.entity.InvokerInstanceId
51+
import org.apache.openwhisk.core.entity.UUID
4952

5053
/**
5154
* Configuration for mesos timeouts
@@ -122,15 +125,12 @@ class MesosContainerFactory(config: WhiskConfig,
122125
}
123126
}
124127

125-
override def createContainer(
126-
tid: TransactionId,
127-
name: String,
128-
actionImage: ExecManifest.ImageName,
129-
userProvidedImage: Boolean,
130-
memory: ByteSize,
131-
cpuShares: Int,
132-
action: Option[ExecutableWhiskAction] = None,
133-
resourceTags: Option[List[String]] = None)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
128+
override def createContainer(tid: TransactionId,
129+
name: String,
130+
actionImage: ExecManifest.ImageName,
131+
userProvidedImage: Boolean,
132+
memory: ByteSize,
133+
cpuShares: Int)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
134134
implicit val transid = tid
135135
val image = actionImage.resolveImageName(Some(
136136
ContainerFactory.resolveRegistryConfig(userProvidedImage, runtimesRegistryConfig, userImagesRegistryConfig).url))

common/scala/src/main/scala/org/apache/openwhisk/core/yarn/YARNContainerFactory.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import akka.util.Timeout
2424
import org.apache.openwhisk.common.{Logging, TransactionId}
2525
import org.apache.openwhisk.core.containerpool._
2626
import org.apache.openwhisk.core.entity.ExecManifest.ImageName
27-
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest, ExecutableWhiskAction, InvokerInstanceId}
27+
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest, InvokerInstanceId}
2828
import org.apache.openwhisk.core.yarn.YARNComponentActor.CreateContainerAsync
2929
import org.apache.openwhisk.core.{ConfigKeys, WhiskConfig}
3030
import pureconfig._
@@ -125,9 +125,7 @@ class YARNContainerFactory(actorSystem: ActorSystem,
125125
actionImage: ExecManifest.ImageName,
126126
unuseduserProvidedImage: Boolean,
127127
unusedmemory: ByteSize,
128-
unusedcpuShares: Int,
129-
action: Option[ExecutableWhiskAction] = None,
130-
resourceTags: Option[List[String]] = None)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
128+
unusedcpuShares: Int)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
131129
implicit val timeout: Timeout = Timeout(containerStartTimeoutMS.milliseconds)
132130

133131
//First send the create command to YARN, then with a different actor, wait for the container to be ready

core/invoker/src/main/resources/application.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,4 @@ whisk {
180180
protocol: http
181181
}
182182
runtime.delete.timeout = "30 seconds"
183-
184-
runtime.resource.role = "openwhisk-runtime-resource-role"
185183
}

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ class ContainerProxy(factory: (TransactionId,
251251
Boolean,
252252
ByteSize,
253253
Int,
254-
Option[ExecutableWhiskAction],
255-
Option[List[String]]) => Future[Container],
254+
Option[ExecutableWhiskAction]) => Future[Container],
256255
sendActiveAck: ActiveAck,
257256
storeActivation: (TransactionId, WhiskActivation, Boolean, UserContext) => Future[Any],
258257
collectLogs: LogsCollector,
@@ -291,7 +290,6 @@ class ContainerProxy(factory: (TransactionId,
291290
job.exec.pull,
292291
job.memoryLimit,
293292
poolConfig.cpuShare(job.memoryLimit),
294-
None,
295293
None)
296294
.map(container =>
297295
PreWarmCompleted(PreWarmedData(container, job.exec.kind, job.memoryLimit, expires = job.ttl.map(_.fromNow))))
@@ -311,8 +309,7 @@ class ContainerProxy(factory: (TransactionId,
311309
job.action.exec.pull,
312310
job.action.limits.memory.megabytes.MB,
313311
poolConfig.cpuShare(job.action.limits.memory.megabytes.MB),
314-
Some(job.action),
315-
job.action.annotations.get(Annotations.InvokerResourcesAnnotationName).map(_.convertTo[List[String]]))
312+
Some(job.action))
316313

317314
// container factory will either yield a new container ready to execute the action, or
318315
// starting up the container failed; for the latter, it's either an internal error starting
@@ -981,8 +978,7 @@ object ContainerProxy {
981978
Boolean,
982979
ByteSize,
983980
Int,
984-
Option[ExecutableWhiskAction],
985-
Option[List[String]]) => Future[Container],
981+
Option[ExecutableWhiskAction]) => Future[Container],
986982
ack: ActiveAck,
987983
store: (TransactionId, WhiskActivation, Boolean, UserContext) => Future[Any],
988984
collectLogs: LogsCollector,

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerContainerFactory.scala

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import org.apache.openwhisk.common.Logging
2626
import org.apache.openwhisk.common.TransactionId
2727
import org.apache.openwhisk.core.WhiskConfig
2828
import org.apache.openwhisk.core.containerpool._
29-
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest, ExecutableWhiskAction, InvokerInstanceId}
29+
import org.apache.openwhisk.core.entity.ByteSize
30+
import org.apache.openwhisk.core.entity.ExecManifest
31+
import org.apache.openwhisk.core.entity.InvokerInstanceId
3032

3133
import scala.concurrent.duration._
3234
import java.util.concurrent.TimeoutException
@@ -55,15 +57,12 @@ class DockerContainerFactory(instance: InvokerInstanceId,
5557
extends ContainerFactory {
5658

5759
/** Create a container using docker cli */
58-
override def createContainer(
59-
tid: TransactionId,
60-
name: String,
61-
actionImage: ExecManifest.ImageName,
62-
userProvidedImage: Boolean,
63-
memory: ByteSize,
64-
cpuShares: Int,
65-
action: Option[ExecutableWhiskAction] = None,
66-
resourceTags: Option[List[String]] = None)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
60+
override def createContainer(tid: TransactionId,
61+
name: String,
62+
actionImage: ExecManifest.ImageName,
63+
userProvidedImage: Boolean,
64+
memory: ByteSize,
65+
cpuShares: Int)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
6766
val registryConfig =
6867
ContainerFactory.resolveRegistryConfig(userProvidedImage, runtimesRegistryConfig, userImagesRegistryConfig)
6968
val image = if (userProvidedImage) Left(actionImage) else Right(actionImage)

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/StandaloneDockerContainerFactory.scala

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import org.apache.commons.lang3.SystemUtils
2222
import org.apache.openwhisk.common.{Logging, TransactionId}
2323
import org.apache.openwhisk.core.{ConfigKeys, WhiskConfig}
2424
import org.apache.openwhisk.core.containerpool.{Container, ContainerFactory, ContainerFactoryProvider}
25-
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest, ExecutableWhiskAction, InvokerInstanceId}
25+
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest, InvokerInstanceId}
2626
import pureconfig._
2727
import pureconfig.generic.auto._
2828

@@ -61,15 +61,12 @@ class StandaloneDockerContainerFactory(instance: InvokerInstanceId, parameters:
6161
private val pulledImages = new TrieMap[String, Boolean]()
6262
private val factoryConfig = loadConfigOrThrow[StandaloneDockerConfig](ConfigKeys.standaloneDockerContainerFactory)
6363

64-
override def createContainer(
65-
tid: TransactionId,
66-
name: String,
67-
actionImage: ExecManifest.ImageName,
68-
userProvidedImage: Boolean,
69-
memory: ByteSize,
70-
cpuShares: Int,
71-
action: Option[ExecutableWhiskAction] = None,
72-
resourceTags: Option[List[String]] = None)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
64+
override def createContainer(tid: TransactionId,
65+
name: String,
66+
actionImage: ExecManifest.ImageName,
67+
userProvidedImage: Boolean,
68+
memory: ByteSize,
69+
cpuShares: Int)(implicit config: WhiskConfig, logging: Logging): Future[Container] = {
7370

7471
//For standalone server usage we would also want to pull the OpenWhisk provided image so as to ensure if
7572
//local setup does not have the image then it pulls it down

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,10 @@ class KubernetesClient(
139139
image: String,
140140
memory: ByteSize = 256.MB,
141141
environment: Map[String, String] = Map.empty,
142-
labels: Map[String, String] = Map.empty,
143-
resourceTags: Option[List[String]],
144-
imagePullSecret: Option[String] = None)(implicit transid: TransactionId): Future[KubernetesContainer] = {
142+
labels: Map[String, String] = Map.empty)(implicit transid: TransactionId): Future[KubernetesContainer] = {
145143

146144
val (pod, pdb) =
147-
podBuilder.buildPodSpec(name, image, memory, environment, labels, config, resourceTags, imagePullSecret)
145+
podBuilder.buildPodSpec(name, image, memory, environment, labels, config)
148146
if (transid.meta.extraLogging) {
149147
log.info(this, s"Pod spec being created\n${Serialization.asYaml(pod)}")
150148
}
@@ -371,8 +369,6 @@ object KubernetesClient {
371369

372370
def formatK8STimestamp(ts: Instant): Try[String] =
373371
Try(K8STimestampFormat.format(ts))
374-
375-
val OPENWHISK_RUNTIME_RESOURCE_ROLE = loadConfigOrThrow[String]("whisk.runtime.resource.role")
376372
}
377373

378374
trait KubernetesApi {
@@ -381,9 +377,7 @@ trait KubernetesApi {
381377
image: String,
382378
memory: ByteSize,
383379
environment: Map[String, String] = Map.empty,
384-
labels: Map[String, String] = Map.empty,
385-
resourceTags: Option[List[String]] = None,
386-
imagePullSecret: Option[String] = None)(implicit transid: TransactionId): Future[KubernetesContainer]
380+
labels: Map[String, String] = Map.empty)(implicit transid: TransactionId): Future[KubernetesContainer]
387381

388382
def rm(container: KubernetesContainer)(implicit transid: TransactionId): Future[Unit]
389383
def rm(podName: String)(implicit transid: TransactionId): Future[Unit]

0 commit comments

Comments
 (0)