Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format code, remove unnecessary parentheses in Invoker #5080

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ trait WhiskActionsApi extends WhiskCollectionAPI with PostActionActivation with

onComplete(checkAdditionalPrivileges) {
case Success(_) =>
putEntity(WhiskAction, entityStore, entityName.toDocId, overwrite, update(user, request) _, () => {
putEntity(WhiskAction, entityStore, entityName.toDocId, overwrite, update(user, request), () => {
make(user, entityName, request)
})
case Failure(f) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
// this can also happen if createContainer fails to start a new container, or
// if a job is rescheduled but the container it was allocated to has not yet destroyed itself
// (and a new container would over commit the pool)
val isErrorLogged = r.retryLogDeadline.map(_.isOverdue).getOrElse(true)
val isErrorLogged = r.retryLogDeadline.forall(_.isOverdue)
val retryLogDeadline = if (isErrorLogged) {
logging.warn(
this,
Expand Down Expand Up @@ -238,7 +238,7 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,

// Container is free to take more work
case NeedWork(warmData: WarmedData) =>
val oldData = freePool.get(sender()).getOrElse(busyPool(sender()))
val oldData = freePool.getOrElse(sender(), busyPool(sender()))
val newData =
warmData.copy(lastUsed = oldData.lastUsed, activeActivationCount = oldData.activeActivationCount - 1)
if (newData.activeActivationCount < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class KubernetesClient(
s"Failed create pod for '$name': ${e.getClass} (Caused by: ${e.getCause}) - ${e.getMessage}; stacktrace: $stackTrace",
ErrorLevel)
Future.failed(KubernetesPodApiException(e))
case Success(createdPod) => {
case Success(createdPod) =>
//call to api-server succeeded; wait for the pod to become ready; catch any failure to end the transaction timer
waitForPod(namespace, createdPod, start.start, config.timeouts.run)
.map { readyPod =>
Expand Down Expand Up @@ -199,7 +199,6 @@ class KubernetesClient(
}
Future.failed(e)
}
}
}
}

Expand Down Expand Up @@ -421,7 +420,7 @@ object KubernetesRestLogSourceStage {
lines: Queue[TypedLogLine] = Queue.empty[TypedLogLine]): Queue[TypedLogLine] = {
if (!src.exhausted()) {
(for {
line <- Option(src.readUtf8Line()) if !line.isEmpty
line <- Option(src.readUtf8Line()) if line.nonEmpty
timestampDelimiter = line.indexOf(" ")
// Kubernetes is ignoring nanoseconds in sinceTime, so we have to filter additionally here
rawTimestamp = line.substring(0, timestampDelimiter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object KubernetesContainer {
//apiserver call failed - this will expose a different error to users
cleanupFailedPod(e, podName, WhiskContainerStartupError(Messages.resourceProvisionError))
case e: Throwable =>
cleanupFailedPod(e, podName, WhiskContainerStartupError(s"Failed to run container with image '${image}'."))
cleanupFailedPod(e, podName, WhiskContainerStartupError(s"Failed to run container with image '$image'."))
}
} yield container
}
Expand Down Expand Up @@ -142,11 +142,10 @@ class KubernetesContainer(protected[core] val id: ContainerId,
maxConcurrent: Int,
entity: Option[WhiskAction] = None)(implicit transid: TransactionId): Future[Interval] = {
entity match {
case Some(e) => {
case Some(e) =>
kubernetes
.addLabel(this, Map("openwhisk/action" -> e.name.toString, "openwhisk/namespace" -> e.namespace.toString))
.map(return super.initialize(initializer, timeout, maxConcurrent, entity))
}
case None => super.initialize(initializer, timeout, maxConcurrent, entity)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import scala.collection.JavaConverters._
class WhiskPodBuilder(client: NamespacedKubernetesClient, config: KubernetesClientConfig) {
private val template = config.podTemplate.map(_.value.getBytes(UTF_8))
private val actionContainerName = KubernetesRestLogSourceStage.actionContainerName
private val actionContainerPredicate: Predicate[ContainerBuilder] = (cb) => cb.getName == actionContainerName
private val actionContainerPredicate: Predicate[ContainerBuilder] = cb => cb.getName == actionContainerName

def affinityEnabled: Boolean = config.userPodNodeAffinity.enabled

Expand Down