You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2022/07/25 07:45:15 UTC

[GitHub] [openwhisk-runtime-java] ningyougang opened a new pull request, #140: Support array result include sequence action

ningyougang opened a new pull request, #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140

   - [x] Support array result
     - [x] make java runtime to support array result for common action
     - [x] make java runtime to support array result for sequence action (support array as input param)


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] ningyougang commented on a diff in pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
ningyougang commented on code in PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r939487344


##########
tests/src/test/scala/actionContainers/JavaActionContainerTests.scala:
##########
@@ -157,9 +157,7 @@ class JavaActionContainerTests extends BasicActionRunnerTests with WskActorSyste
 
         val expected = m match {
           case c if c == "x" || c == "!" => s"$errPrefix java.lang.ClassNotFoundException: example.HelloWhisk$c"
-          case "#bogus" =>
-            s"$errPrefix java.lang.NoSuchMethodException: example.HelloWhisk.bogus(com.google.gson.JsonObject)"
-          case _ => s"$errPrefix java.lang.NoSuchMethodException: example.HelloWhisk.main(com.google.gson.JsonObject)"
+          case _                         => s"$errPrefix java.lang.NoSuchMethodException"

Review Comment:
   Due to https://github.com/apache/openwhisk-runtime-java/pull/140/files#r939487201, need to change test case here for a small change as above.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] ningyougang commented on a diff in pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
ningyougang commented on code in PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r945432150


##########
core/java8actionloop/Dockerfile:
##########
@@ -31,13 +31,13 @@ RUN curl -sL \
   https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
   | tar xzf -\
   && cd openwhisk-runtime-go-*/main\
-  && GO111MODULE=on go build -o /bin/proxy
+  && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
 
 # Use AdoptOpenJDK's JDK8, OpenJ9, ubuntu
 FROM ibm-semeru-runtimes:open-8u332-b09-jdk-focal
 
 # select the builder to use
-ARG GO_PROXY_BUILD_FROM=release
+ARG GO_PROXY_BUILD_FROM=source

Review Comment:
   @dgrove-oss , due to go runtime : 1.20.0 is released, i have updated all runtime prs(support array result)'s Dockerfile to apply this. 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] ningyougang commented on pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
ningyougang commented on PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#issuecomment-1193703280

   Test `make java runtime to support array result for sequence action (support array as input param)`'s steps as below
   * Write Split.java and Sort.java
   ```java
   [root@nccddev130026 ~]# cat ~/Split.java 
   import com.google.gson.JsonArray;
   import com.google.gson.JsonObject;
   
   public class Split {
       public static JsonArray main(JsonObject args) {
           String separator = "\n";
           if (args.has("separator")) {
               separator = args.getAsJsonPrimitive("separator").getAsString();
           }
           String payLoad = "aaaa\nbbbb\ncccc";
           if (args.has("payload")) {
               payLoad = args.getAsJsonPrimitive("payload").getAsString();
           }
           JsonArray jsonArray = new JsonArray();
           String[] stringArray = payLoad.split(separator);
           for(String element: stringArray) {
               jsonArray.add(element);
           }
           return jsonArray;
       }
   }
   
   [root@nccddev130026 ~]# cat ~/Sort.java 
   import com.google.gson.JsonArray;
   
   public class Sort {
       public static JsonArray main(JsonArray args) {
           JsonArray newJsonArray = new JsonArray();
           for(int i=args.size()-1;i>=0;i--) {
               newJsonArray.add(args.get(i).getAsString());
           }
           return newJsonArray;
       }
   }
   ```
   * Create java sequence action & invoke it
   ```shell
   javac -classpath "/root/gson-2.9.0.jar" Split.java
   jar cvf split.jar Split.class
   wsk -i action create /whisk.system/utils/split-java split.jar --main Split --kind java:8
   
   javac -classpath "/root/gson-2.9.0.jar" Sort.java
   jar cvf sort.jar Sort.class
   
   wsk -i action create /whisk.system/utils/sort-java sort.jar --main Sort --kind java:8
   wsk -i action create mySequence-java --sequence /whisk.system/utils/split-java,/whisk.system/utils/sort-java
   wsk -i action invoke --result mySequence-java --param payload "aaaa\nbbbb\ncccc" -r -v
   ```


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] dgrove-oss commented on a diff in pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
dgrove-oss commented on code in PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r939689436


##########
core/java8actionloop/Dockerfile:
##########
@@ -31,13 +31,13 @@ RUN curl -sL \
   https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
   | tar xzf -\
   && cd openwhisk-runtime-go-*/main\
-  && GO111MODULE=on go build -o /bin/proxy
+  && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
 
 # Use AdoptOpenJDK's JDK8, OpenJ9, ubuntu
 FROM ibm-semeru-runtimes:open-8u332-b09-jdk-focal
 
 # select the builder to use
-ARG GO_PROXY_BUILD_FROM=release
+ARG GO_PROXY_BUILD_FROM=source

Review Comment:
   We could do a wave of runtime releases, starting the the go runtime.   Would be reasonable to plan to get the go runtime released this week (takes 72 hours for the vote). 



##########
core/java8actionloop/Dockerfile:
##########
@@ -31,13 +31,13 @@ RUN curl -sL \
   https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
   | tar xzf -\
   && cd openwhisk-runtime-go-*/main\
-  && GO111MODULE=on go build -o /bin/proxy
+  && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
 
 # Use AdoptOpenJDK's JDK8, OpenJ9, ubuntu
 FROM ibm-semeru-runtimes:open-8u332-b09-jdk-focal
 
 # select the builder to use
-ARG GO_PROXY_BUILD_FROM=release
+ARG GO_PROXY_BUILD_FROM=source

Review Comment:
   We could do a wave of runtime releases, starting with the go runtime.   Would be reasonable to plan to get the go runtime released this week (takes 72 hours for the vote). 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] ningyougang commented on a diff in pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
ningyougang commented on code in PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r939487201


##########
core/java8actionloop/lib/src/Launcher.java:
##########
@@ -59,18 +59,22 @@ private static void initMain(String[] args) throws Exception {
         }
 
         mainClass = Class.forName(mainClassName);
-        Method m = mainClass.getMethod(mainMethodName, new Class[] { JsonObject.class });
-        m.setAccessible(true);
-        int modifiers = m.getModifiers();
-        if (m.getReturnType() != JsonObject.class || !Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
+        Method[] methods = mainClass.getDeclaredMethods();
+        Boolean existMain = false;
+        for(Method method: methods) {
+            if (method.getName().equals(mainMethodName)) {
+                existMain = true;
+                break;
+            }
+        }
+        if (!existMain) {
             throw new NoSuchMethodException(mainMethodName);
         }
-        mainMethod = m;

Review Comment:
   Because need to support array result, cannot instantiate mainMethod in `/init` step, should move this relative logic to `/run` logic due to input param/out result can be `JsonObject or JsonArray`



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] ningyougang commented on a diff in pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
ningyougang commented on code in PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r939487592


##########
core/java8actionloop/Dockerfile:
##########
@@ -31,13 +31,13 @@ RUN curl -sL \
   https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
   | tar xzf -\
   && cd openwhisk-runtime-go-*/main\
-  && GO111MODULE=on go build -o /bin/proxy
+  && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
 
 # Use AdoptOpenJDK's JDK8, OpenJ9, ubuntu
 FROM ibm-semeru-runtimes:open-8u332-b09-jdk-focal
 
 # select the builder to use
-ARG GO_PROXY_BUILD_FROM=release
+ARG GO_PROXY_BUILD_FROM=source

Review Comment:
   @style95 seems change GO_PROXY_BUILD_FROM to `source` is not better, but in order to support array result, must  use go runtime's upstream master code.
   
   Can we release a new version for go runtime? e.g. https://github.com/apache/openwhisk-runtime-java/blob/master/core/java8actionloop/Dockerfile#L29



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] ningyougang commented on a diff in pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
ningyougang commented on code in PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140#discussion_r939487592


##########
core/java8actionloop/Dockerfile:
##########
@@ -31,13 +31,13 @@ RUN curl -sL \
   https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
   | tar xzf -\
   && cd openwhisk-runtime-go-*/main\
-  && GO111MODULE=on go build -o /bin/proxy
+  && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
 
 # Use AdoptOpenJDK's JDK8, OpenJ9, ubuntu
 FROM ibm-semeru-runtimes:open-8u332-b09-jdk-focal
 
 # select the builder to use
-ARG GO_PROXY_BUILD_FROM=release
+ARG GO_PROXY_BUILD_FROM=source

Review Comment:
   @style95 seems change GO_PROXY_BUILD_FROM to `source` is not better, but in order to support array result, must  use go runtime's upstream master code.
   
   Can we release a new version for go runtime? e.g. https://github.com/apache/openwhisk-runtime-java/blob/master/core/java8actionloop/Dockerfile#L29
   Change



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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


[GitHub] [openwhisk-runtime-java] dgrove-oss merged pull request #140: Support array result include sequence action

Posted by GitBox <gi...@apache.org>.
dgrove-oss merged PR #140:
URL: https://github.com/apache/openwhisk-runtime-java/pull/140


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

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