ysjjovo commented on a change in pull request #4424: Delete pod when creating
timeout
URL:
https://github.com/apache/incubator-openwhisk/pull/4424#discussion_r272081921
##########
File path:
core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/KubernetesClient.scala
##########
@@ -168,11 +158,26 @@ class KubernetesClient(
.waitUntilReady(config.timeouts.run.length, config.timeouts.run.unit)
toContainer(createdPod)
}
- }.recoverWith {
- case e =>
- log.error(this, s"Failed create pod for '$name': ${e.getClass} -
${e.getMessage}")
- Future.failed(new Exception(s"Failed to create pod '$name'"))
- }
+ }.andThen {
+ case Failure(e) => log.error(this, s"Failed create pod for '$name':
${e.getClass} - ${e.getMessage}")
+ }
+ .recoverWith {
+ case _ =>
+ Future {
+ blocking {
+ kubeRestClient
+ .inNamespace(kubeRestClient.getNamespace)
+ .pods()
+ .withName(name)
+ .delete()
+ }
+ }.andThen {
+ case Failure(e) => log.error(this, s"Failed delete pod for
'$name': ${e.getClass} - ${e.getMessage}")
+ }
+ .transformWith { _ =>
Review comment:
Nice suggestion!,But I can't fix alignment due to Intellij will auto start
with a new line with '.transformWith'.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services