Http Background RequestHi,
I am trying to use the HTTP Request function but it often can take some time to return the data I am requesting. I am wondering if it is possible to send an HTTP request in a background and then continue on with the script. Later when the data is needed I could check to see if it is returned and then either continue on or wait for it to be returned. If this is possible I could parallelized multiple request that are needed instead of running them in serial.
Thanks for your help
ScriptingRe: Http Background RequestGreetings, i can report that there has been some work done in this area in the JMP 17 timeframe. More than one HTTP Request can now be sent in the form of a new function named New Multi HTTP Request(). JMP 17 will be generally available in the fall of 2022. If you have access to the Early Adopter program, you are able to try this out now.
Re: Http Background RequestCan JMP run JMP?
Schedule only runs in the foreground, when JMP is idle (or wait() is called from a running script.)
Re: Http Background RequestI have never tried this myself but JSL has a "Schedule()" command that can create an independent thread. However, you cannot create more than 1 thread. So, in your case the HTTP request can be sent to that thread but they will still run in series.
https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/scheduling-actions.shtml
Update: See Craig Hales' reply below. Apparently, commands scheduled this way only run when JMP is idle and the commands still run in the foreground. I didn't have a good example to prototype something before I replied. Sorry if I caused any confusion.
Another approach could be that you run multiple instances of JMP by using the "Run Program()" command. I believe these can be made to run without waiting for the external program to finish executing. I tried this before but never for multi-threading. You just gave me an idea that I want to try now!
https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/run-external-programs.shtml
https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/utility-functions.shtml#ww4547957
Update2: Also see Craig Hales' blog post on this idea. Thanks a lot Craig! https://community.jmp.com/t5/Uncharted/Can-JMP-run-JMP/ba-p/283748
I don't think either of these solutions are ideal but they probably will improve your script's run time. The first one is easier to implement, the second will require some rearchitecting of your code and you have to deal with starting and quitting JMP.