Restart batch processes from NG-Client

Forum to discuss the new web client version of Servoy.

Restart batch processes from NG-Client

Postby rph » Thu Dec 14, 2023 12:21 pm

Hi

Is there a way to restart a batch-process-job from within an NG-client? It would be ideal, if there is an API for accessing the Servoy-Admin-Page.

Background: we use batch process for various jobs. Usually they work fine, but from time to time they hang up and stop. We'd like to give a (power-)user an easy way to check, if the batch processes are still running and if not to restart again (without to go on the Servoy-Admin-Page). I know about the "plugins.UserManager.getBatchProcessors()"-function. With that I get a list of batch-processes, but I can't do anything with that (not stop or start).

Thanks in advance for any suggestions.
Best, Roland
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Restart batch processes from NG-Client

Postby mboegem » Thu Dec 14, 2023 12:50 pm

Hi Roland,

The batch processor is no more than a headless client.
You can spawn a headless client using the headless client plugin

By using the client manager plugin, you can get all connected clients, their types and you will have the possibility to shutdown a particular client.

Concerning the UserManager plugin, this plugin is no longer supported. (direct information from the developer)
This means that the plugin can no longer be used in Servoy versions 2022.9 and higher, without modifying the jar file yourself.
Future Servoy version might even break the plugin as the ServoyAPI might change.

Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Restart batch processes from NG-Client

Postby rph » Thu Dec 14, 2023 2:37 pm

Hi Marc

Thank you very much for your quick response!

But this is not what I'm looking for. The problem is, that in some circumstances the batch process will be shut down (status "not running" in Servoy-Admin-Console) and so the client is not there anymore and in consequence the client manager can't deliver it. And if I want to restart it, I have to know all the starting arguments that are stored on the "batch process" (solutionname, username, password, starting arguments). These are informations I'll never get from the client manager.

Maybe there's another solution?

Best, Roland

... and yes, I've heard that the UserManager-Plugin is not supported anymore. So I'm still hoping that Servoy will deliver an alternative for it in the future (I've heard rumours that there could come something like an API to access the whole stuff in the Servoy-Admin-Console). Hope dies last ;-)
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Restart batch processes from NG-Client

Postby jcompagner » Thu Dec 14, 2023 3:38 pm

i think it is also a good thing to look why batch processors are suddenly not running... are the exceptions?

Also what you could do is having 1 batch processor running, which just spawn the other "batch" processors as headless clients (under unique names)
and those can be checked then by something (a batch or another headless)

Edit: are you sure they are not running anymore? and then i don't mean check the status, but if you would do some output when the batch does something are those stopping?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Restart batch processes from NG-Client

Postby rph » Thu Dec 14, 2023 4:16 pm

Hi Johan

Thank you too for your response.

i think it is also a good thing to look why batch processors are suddenly not running... are the exceptions?


Yes, of course. This would always be the best solution! And we are working on that. But sometimes it's not so easy to locate the problem and specially not in headless clients.

For example one problem we have is a batch process that calls a webservice periodically. As soon as we have a connection issue (network problem) the webservice call of course doesn't work anymore. But it also doesn't recover, even if the network issue is solved. We then have to shutdown the client and start it again (so in this specific situation, the solution from Marc would work because the headless client is still running but doesn't work anymore as expected, but still has the downside that I have to know all the startup arguments for the client).

In another case (also a webservice that is called periodically) the client is gone completely. In that case we don't have any trace so far.

Because this all is not happend so often but only from time to time (maybe once a week or so) and so far we couldn't reproduce it, it's quite hard to fix something.
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Restart batch processes from NG-Client

Postby dcamargo » Thu Dec 14, 2023 6:25 pm

Hi Roland,

I have found that it's easier to implement some sort of a job management feature than relying only on Batch Processors.
The way I did it was to have a table to store the jobs (function to be called, recurrence, credentials, etc) and another table to store each run of the job (start, end, duration, result) in that way I can also troubleshoot what could be happening by adding log messages to the result.

Your power user then can create/start/stop/monitor/troubleshoot those jobs.
One client needs to be responsible for starting them all (a single batch processor as Johan said) or a post import hook.

I think Patrick Rushert has a similar implementation too.
Danny Camargo
Servoy & Web Developer
dcamargo
 
Posts: 13
Joined: Tue Aug 23, 2016 8:59 pm

Re: Restart batch processes from NG-Client

Postby rph » Thu Dec 14, 2023 6:42 pm

Hi Danny

Thank you too for your inputs!

I'll give the jobmanager way a try! Obiously it's easier to achive that way!

Best, Roland
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: Restart batch processes from NG-Client

Postby swingman » Thu Dec 14, 2023 10:58 pm

Re calling web-service, we have had similar problems with batch processors falling over every few weeks.
The code was old having run for 10+ years and needed a refresh;

Changes I made:

- Set a timeout setTimeOut(number) so the http client gives up after a while.
- Always check the response before trying to process looking whether response.getException() is blank.
- close the http client after use to free up memory.
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: Restart batch processes from NG-Client

Postby rph » Fri Dec 15, 2023 9:13 am

Hi Christian

Thank you too for your inputs. I'll take that in count, too.

Best, Roland
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 18 guests

cron