We kept having an issue where the app would successfully deploy to all the nodes in the cluster, but for an unknown reason the app would only partially startup, or not startup at all. This would require our on-call to be paged, get on the phone, login to the WAS console, and manually restart the app.
I suspect that the recent errors occurred because the script was trying to start the app before the app was fully synced and installed, which meant it may start on some cluster nodes, but not all of them, resulting in our team having to manually go start the app.
By utilizing the AdminApp.isAppReady(app) function, the script will now verify whether the app is ready to start or not. If the app is ready right after install, it’s smooth sailing and the app will be started. However, if the app is not ready to be started, the script will sleep for 30 seconds, and then inspect the app again to see if it is ready. The script will do this a maximum of 5 times, but on the first instance of the app being ready, the app will be started. After the 5th time, the app will try to be started anyway and a log entry made that it MAY need further attention. At that point the interested party should attempt to hit the app and see if it is ready or not, and call us if needed.
import sys import time # get line separator lineSeparator = java.lang.System.getProperty('line.separator') print "Verify app is ready to start, and if not, give it more time to get ready" ctr = 0 result = AdminApp.isAppReady(app) print "initial isAppReady=" + result while (result == "false" and ctr < 6): print "APP IS NOT READDY TO START!!!! Sleeping to give app time to be ready to start..." time.sleep(30) result = AdminApp.isAppReady(app) print "isAppReady=" + result ctr += 1 if(result == "false"): print "final isAppReady=false and app MAY need additional attention"