openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [openwhisk] rabbah commented on a change in pull request #4559: Allow parameters to be designated as init time properties
Date Fri, 23 Aug 2019 09:05:40 GMT
rabbah commented on a change in pull request #4559: Allow parameters to be designated as init
time properties
URL: https://github.com/apache/openwhisk/pull/4559#discussion_r317040232
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
 ##########
 @@ -770,6 +770,31 @@ object ContainerProxy {
           causedBy ++ initTime ++ binding
       })
   }
+
+  /**
+   * Partitions the activation arguments into two JsObject instances. The first is exported
as intended for export
+   * by the action runtime to the environment. The second is passed on as arguments to the
action.
+   *
+   * @param content the activation arguments
+   * @param initArgs set of parameters to treat as initialization arguments
+   * @return A partition of the arguments into an environment variables map and the JsObject
argument to the action
+   */
+  def partitionArguments(content: Option[JsObject], initArgs: Set[String]): (Map[String,
JsString], JsObject) = {
+    content match {
+      case None                         => (Map.empty, JsObject.empty)
+      case Some(js) if initArgs.isEmpty => (Map.empty, js)
+      case Some(js) =>
+        val (env, args) = js.fields.partition(k => initArgs.contains(k._1))
+
+        (env.map {
 
 Review comment:
   Agreed. I wanted to defer stringify to `containerInitializer().` 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message