openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject [openwhisk-devtools] branch master updated: Automate the JVM pre-caching of classes for a given profile (#290)
Date Tue, 17 Sep 2019 21:21:24 GMT
This is an automated email from the ASF dual-hosted git repository.

pdesai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-devtools.git


The following commit(s) were added to refs/heads/master by this push:
     new 37ab38b  Automate the JVM pre-caching of classes for a given profile (#290)
37ab38b is described below

commit 37ab38b9017f0aef7c41b278c38aacc9a6e4193f
Author: Matt Rutkowski <mrutkows@us.ibm.com>
AuthorDate: Tue Sep 17 16:21:19 2019 -0500

    Automate the JVM pre-caching of classes for a given profile (#290)
    
    * Automate the JVM pre-caching of classes for a given profile
    
    * Execute pre-cache and accunt for Linux base64 enc. diffs.
    
    * Execute pre-cache and accunt for Linux base64 enc. diffs.
    
    * Remove files with typos
---
 .../java/core/java8/proxy/buildProfileClasses.sh     |  9 ++++++++-
 .../java/core/java8/proxy/compileClassCache.sh       |  9 ++++++++-
 .../java8/proxy/profiles/base/tests/build_all.sh     |  8 +++++++-
 .../java8/proxy/profiles/base/tests/clean_all.sh     |  2 +-
 .../java8/proxy/profiles/base/tests/exec_tests.sh    |  8 ++------
 .../base/tests/helloworld/native-data-init-run.json  | 18 ------------------
 .../helloworldwithparams/native-data-init-run.json   | 20 --------------------
 .../native-data-init-run.json                        | 20 --------------------
 .../proxy/profiles/base/tests/update_payloads.sh     |  2 +-
 9 files changed, 27 insertions(+), 69 deletions(-)

diff --git a/knative-build/runtimes/java/core/java8/proxy/buildProfileClasses.sh b/knative-build/runtimes/java/core/java8/proxy/buildProfileClasses.sh
index a251888..e8b1976 100755
--- a/knative-build/runtimes/java/core/java8/proxy/buildProfileClasses.sh
+++ b/knative-build/runtimes/java/core/java8/proxy/buildProfileClasses.sh
@@ -21,7 +21,14 @@ cd profiles/base/tests
 # Clean out previous build artifacts
  ./clean_all.sh
 
- # Create new build artifacts
+ # Create new build artifacts (e.g., JAR, ZIP, and their base64 encodings)
  ./build_all.sh
 
+ # Update the HTTP (body) payloads for OW and Knative (with base64 encoded archives)
+./update_payloads.sh
+
+# execute the functions that will cause the JVM cache to be populated for the profile
+# (e.g., invoke the /init and /run methods for each profile's "test" functions).
+./exec_tests.sh
+
  cd ../../..
diff --git a/knative-build/runtimes/java/core/java8/proxy/compileClassCache.sh b/knative-build/runtimes/java/core/java8/proxy/compileClassCache.sh
index 5ecc9b0..581375e 100755
--- a/knative-build/runtimes/java/core/java8/proxy/compileClassCache.sh
+++ b/knative-build/runtimes/java/core/java8/proxy/compileClassCache.sh
@@ -15,7 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-set -x
+set +x
 
 # Standard Options:
 # ================
@@ -38,6 +38,7 @@ JAVA_STANDARD_OPTIONS="-Dfile.encoding=UTF-8"
 # #### Construct Class Cache with HTTP Server classes by starting the server ####
 JAVA_EXTENDED_OPTIONS="-Xshareclasses:cacheDir=/javaSharedCache/ -Xquickstart"
 JAVA_VERBOSE_OPTIONS="-verbose:class -verbose:sizes"
+#JAVA_VERBOSE_OPTIONS=""
 JAVA_JVM_KILL_DELAY=5s
 
 export OW_ALLOW_MULTIPLE_INIT=true
@@ -45,7 +46,13 @@ export OW_ALLOW_MULTIPLE_INIT=true
 echo "Creating shared class cache with Proxy and 'base' profile libraries..."
 java $JAVA_VERBOSE_OPTIONS $JAVA_STANDARD_OPTIONS $JAVA_EXTENDED_OPTIONS "-jar" "/javaAction/build/libs/javaAction-all.jar"
&
 HTTP_PID=$!
+
+echo "Building pre-cache functions and executing..."
+./buildProfileClasses.sh
+
 echo "Sleeping (${JAVA_JVM_KILL_DELAY}) allowing cache to be populated before killing JVM
process (${HTTP_PID})..."
 sleep $JAVA_JVM_KILL_DELAY
 echo "Killing JVM process (${HTTP_PID})..."
 kill $HTTP_PID
+
+unset OW_ALLOW_MULTIPLE_INIT
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/build_all.sh
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/build_all.sh
index ba2cdd5..667f92c 100755
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/build_all.sh
+++ b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/build_all.sh
@@ -28,7 +28,13 @@ for f in *; do
         echo "Creating JAR..."
         jar cvf hello.jar *.class
         echo "Base64 encoding JAR..."
-        base64 hello.jar > hello.jar.base64
+        unameOut="$(uname -s)"
+        case "${unameOut}" in
+            Linux*)   B64_WRAP="-w0";;
+            Darwin*)  B64_WRAP="";;
+        esac
+        #base64 -w0 hello.jar > hello.jar.base64
+        base64 $B64_WRAP hello.jar > hello.jar.base64
         cd ..
     fi
 done
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/clean_all.sh
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/clean_all.sh
index f38bed3..fd8d5ed 100755
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/clean_all.sh
+++ b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/clean_all.sh
@@ -23,7 +23,7 @@ for f in *; do
         echo "Cleaning up build artifacts for test: '${f}'"
         cd $f
         rm Hello.class
-        rm Hello.jar
+        rm hello.jar
         rm hello.jar.base64
         rm openwhisk-data-init.json
         rm knative-data-init.json
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/exec_tests.sh
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/exec_tests.sh
index 5db373a..2590675 100755
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/exec_tests.sh
+++ b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/exec_tests.sh
@@ -22,12 +22,8 @@ for f in *; do
     if [ -d ${f} ]; then
         echo "Updating 'code' payload with base64 encoded archive data: ${f}"
         cd $f
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" openwhisk-data-init.json.tmpl
> openwhisk-data-init.json
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" knative-data-init.json.tmpl
> knative-data-init.json
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" knative-data-init-run.json.tmpl
> native-data-init-run.json
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" payload-knative-init.http.tmpl
> payload-knative-init.http
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" payload-knative-init-run.http.tmpl
> payload-knative-init-run.http
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" payload-openwhisk-init.http.tmpl
> payload-openwhisk-init.http
+            curl -d "@openwhisk-data-init.json" -H "Content-Type: application/json" -X POST
http://localhost:8080/init
+            curl -d "@openwhisk-data-run.json" -H "Content-Type: application/json" -X POST
http://localhost:8080/run
         cd ..
     fi
 done
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworld/native-data-init-run.json
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworld/native-data-init-run.json
deleted file mode 100644
index 30282d3..0000000
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworld/native-data-init-run.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-  "init": {
-    "name": "java-helloworld",
-    "main": "Hello",
-    "binary": true,
-    "code" : "UEsDBBQACAgIAA18LU8AAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAANfC1PAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEGxkYKWi4JudkFhSnKvgXpOZ5WWrycvFyAQBQSwcIMFMkp0EAAABBAAAAUEsDBBQACAgIAA18LU8AAAAAAAAAAAAAAAALAAAASGVsbG8uY2xhc3N9UmtP02AUfg67tHSdzAJD0CHzRjcGVREvjJCIiTFmKMkMiX57t72pxV6WriP6U/wX+mUkkvgD/E3GeN7GaYKDJj2X9znnec572h+/vn0H8ABNAxYqOpZ1XDegYUWZqoEbuKnhlkoYvK3hjgFDhavK2zpqytcVvqahoWGdkN
[...]
-  },
-  "activation": {
-    "namespace": "default",
-    "action_name": "java-helloworld",
-    "api_host": "",
-    "api_key": "",
-    "activation_id": "",
-    "deadline": "4102498800000"
-  },
-  "value": {
-  }
-}
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworldwithparams/native-data-init-run.json
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworldwithparams/native-data-init-run.json
deleted file mode 100644
index 752b692..0000000
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworldwithparams/native-data-init-run.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-    "init": {
-        "name" : "java-helloworld-with-params",
-        "main" : "Hello",
-        "binary": true,
-        "code" : "UEsDBBQACAgIAA18LU8AAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAANfC1PAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEGxkYKWi4JudkFhSnKvgXpOZ5WWrycvFyAQBQSwcIMFMkp0EAAABBAAAAUEsDBBQACAgIAA18LU8AAAAAAAAAAAAAAAALAAAASGVsbG8uY2xhc3N9Uu1uEkEUPcPXLssiuG2t1KJQtQUKRW39KrW1mhhjoDbBNFHjjwHG7db9IMtS46P4BP7VPzSxiQ/gO2m8s4omlXZn986dO2fPOXMz339+/QZgDdsaZlBQUVSxoOKqhiSuyXBdwyKWVJQUlOWaIBUFyxp0mVblXFOxoq
[...]
-    },
-    "activation": {
-        "namespace": "default",
-        "action_name": "java-helloworld-with-params",
-        "api_host": "",
-        "api_key": "",
-        "activation_id": "",
-        "deadline": "4102498800000"
-    },
-    "value": {
-        "name" : "Joe",
-        "place" : "TX"
-    }
-}
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworldwithparamsfromenv/native-data-init-run.json
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworldwithparamsfromenv/native-data-init-run.json
deleted file mode 100644
index ca94e97..0000000
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/helloworldwithparamsfromenv/native-data-init-run.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-    "init": {
-        "name" : "java-helloworld-with-params-from-env",
-        "main" : "Hello",
-        "binary": true,
-        "code" : "UEsDBBQACAgIAA58LU8AAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAOfC1PAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEGxkYKWi4JudkFhSnKvgXpOZ5WWrycvFyAQBQSwcIMFMkp0EAAABBAAAAUEsDBBQACAgIAA58LU8AAAAAAAAAAAAAAAALAAAASGVsbG8uY2xhc3ONUttu00AUnNMmsesaWtzQGxQSLq3TNjW3Jwo8gIQQCgUpqBKPm/hgubJ3I9ep1L+ClxRRiQ/goxBnQ7kIAsKWZ2dnz5lZ2/v5y8dPAO7hrocLWHVxycNlrLm44uCqh6qVGg6aHlxLr9nxuosbLm5aum5LNhyEDlqE2o
[...]
-    },
-    "activation": {
-        "namespace": "default",
-        "action_name": "java-helloworld-with-params-from-env",
-        "api_host": "",
-        "api_key": "",
-        "activation_id": "",
-        "deadline": "4102498800000"
-    },
-    "value": {
-        "name" : "Jess",
-        "place" : "OK"
-    }
-}
diff --git a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/update_payloads.sh
b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/update_payloads.sh
index 5db373a..6d73a6e 100755
--- a/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/update_payloads.sh
+++ b/knative-build/runtimes/java/core/java8/proxy/profiles/base/tests/update_payloads.sh
@@ -24,7 +24,7 @@ for f in *; do
         cd $f
             sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" openwhisk-data-init.json.tmpl
> openwhisk-data-init.json
             sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" knative-data-init.json.tmpl
> knative-data-init.json
-            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" knative-data-init-run.json.tmpl
> native-data-init-run.json
+            sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" knative-data-init-run.json.tmpl
> knative-data-init-run.json
             sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" payload-knative-init.http.tmpl
> payload-knative-init.http
             sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" payload-knative-init-run.http.tmpl
> payload-knative-init-run.http
             sed "s#BASE64_ENCODED_JAR#$(cat hello.jar.base64)#" payload-openwhisk-init.http.tmpl
> payload-openwhisk-init.http


Mime
View raw message