KUIB App Errors After Trimming PAS Agents

Posted by jts-law on 11-Aug-2017 11:11

Hi All,

I'm still new to both PAS and KUIB and after searching a while for any information on this issue I can't find anything.

As part of my KUIB app I make some separate $http get/put requests.  When I make a code change to the backend, I stop the agents so that the new code is loaded as the new agents start.  The issue is that after stopping the agents, the first time the KUIB app loads, my separate get/put requests fail with 500 errors.  If I then refresh the page everything works fine because the PAS agents are already running.

Do I need to configure something in PAS so that the requests queues up while the agent(s) start, or do I have to handle this within the KUIB app?

Thanks,

Louis

Posted by Irfan on 11-Aug-2017 13:54

Also, we are aware of the problem with first requests failure when we perform deletion/termination of the agent and we are working on a fix for it for the future releases. So to update new code, I would suggest terminateIDLESessions as a right choice.

All Replies

Posted by Irfan on 11-Aug-2017 13:10

Hi Louis,

We do not need to stop the agent if we want to update the ABL code. You can follow the same approach that we follow with PDSOE while publishing updated code to the PASOE Server.

You can use the oemanager API(terminate inactive Sessions) to terminate the sessions that are sitting IDLE. On your next request, new sessions will be started and they will load the updated classes.

Here are the details to call that API

URI - http://<host>:<port>/oemanager/applications/<appname>/<agentId>/sessions

HTTP Operation - DELETE

Media type - Application/vnd.progress+json

Command-line example

   curl -X DELETE -v -u username:password "localhost:8810/.../sessions"

Posted by Anil Kumar on 11-Aug-2017 13:28

Hi Louis,
 
When using PDS OE development environment for publishing code automatically to PASOE server, it is not required to stop the agents explicitly. i.e., when ‘Automatically publish when resources change’ option in the oepas1 instance (or any PASOE instance) in the Publishing options (Servers view -> oepas1 -> Open -> Publishing) is selected then any changes we made in the ABL Editor (for ABL files) will automatically be published and can be consumed properly in KUIB or any other client without any problems. Alternatively if ‘Neve publish automatically’ option is selected, we can explicitly publish changes (Servers view -> oepas1 -> Publish) on demand.
 
In either of the above cases, after publishing code successfully to PASOE server respective data can be accessed properly from KUIB (or any other clients) seamlessly without the need of refreshing/reloading the app.
 
Thanks and Regards,
Anil Kumar.
 

Posted by jts-law on 11-Aug-2017 13:40

Great, thanks Irfan.

In regards to the DELETE operation, is there a call get the list of agent(s) and session(s) similar to the Agents screen in OE Explorer?  If not, do you have to use OE Explorer to get the <agentid> or is there another method so that everything can be done from the command line?

Louis

Posted by Irfan on 11-Aug-2017 13:46

Lous,

In-order to get all the HTTP sessions then you do

   http://<host>:<port>/oemanager/applications/<appName>/sessions

In-order to get all agents

  http://<host>:<port>/oemanager/applications/<appName>/agents

In-order to get all the sessions of an agent

   http://<host>:<port>/oemanager/applications/<appName>/agents/<agentId>/sessions

All these can be done by performing HTTP requests from cURL,ABL,browser,javascript etc. We are working on providing all this information from command-line(without installation of oemanager) in future releases.

Posted by Peter Judge on 11-Aug-2017 13:46

You can use simple REST calls.
 
GET http://localhost:8820/oemanager/applications/mediaresource/agents  (where you replace ‘mediaresource’ with your ABL application name which defaults to the instance name
 
To kill an agent
DELETE localhost:8820/.../14700 where you replace 14700 with the agentPID from the previous call (in addition to the mediaresource).
 

Posted by jts-law on 11-Aug-2017 13:47

Anil,

Thanks for the information.  I ran into an issue a while back where the code  executing wasn't updated but my guess is I just sent my requests to quick.  After running a few tests just now it appears the code is updating correctly without stopping the agents.

Since I don't necessarily need to stop the agents, I should only get the 500 errors on the first call(s) right after PAS is started.  I'd still like to handle these if it isn't too much work.  Any thoughts on that aspect of my original question.  I found the following posts regarding $httpProvider.interceptors but can't figure out within the KUIB architecture how to get this to work.

stackoverflow.com/.../retry-failed-requests-with-http-interceptor

stackoverflow.com/.../alternative-of-httpprovider-responseinterceptors

Louis

Posted by jts-law on 11-Aug-2017 13:50

Irfan/Peter,

Perfect!  Thanks for the info and doc reference, this will definitely help streamline the management of PAS for us.

Louis

Posted by Irfan on 11-Aug-2017 13:54

Also, we are aware of the problem with first requests failure when we perform deletion/termination of the agent and we are working on a fix for it for the future releases. So to update new code, I would suggest terminateIDLESessions as a right choice.

Posted by Dustin Grau on 11-Aug-2017 13:56

Also try this little program and tell me how it works for you. Simply place it in your PASOEContent/static folder, and publish to your instance. Run it at /static/devinfo.html to view data about your PAS instance and to "delete" your agent or sessions. It illustrates use of the above documented API using jQuery.

www.dropbox.com/.../devinfo.html

Posted by egarcia on 11-Aug-2017 15:01

Hello Louis,

Kendo UI Builder uses the Kendo UI DataSource which internally uses the JSDO. The JSDO uses the XMLHttpRequest object (XHR) to communicate with the backend.

I do not expect the Angular interceptors to work with direct XHR calls.

There are ways that we could overload the XHR object used by the JSDO to intercept the request.

However, personally, I would go with Irfan's suggestion of using terminateIDLESessions.

I hope this helps,

Edsel

Posted by jts-law on 11-Aug-2017 15:09

Dustin,

Thanks for the program, I have it installed but unfortunately it isn't working.  I believe this is because I am currently running all of this from the KUIB dev/node.js environment.  Due to the nature of the application, even when I release this to production we will not be serving the KUIB app from PAS, we will have this on IIS.  The program is still very useful as I can get some great information and examples from it.

Thanks again.

Louis

This thread is closed