11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

116 webMathematica User GuideIn this example, the variable id is initialized with the result of a Mathematica computation. Thisis then used in a number of different when or otherwise tags. The final page depends on whatwas stored in the input parameter.Queuing of Long CalculationsThe standard usage of webMathematica carries out calculations inside of a single HTTP request.Mathematica can do a tremendous amount during an HTTP request and so many interestingwebsites can be built. However, if you want to run longer calculations, taking more time than atypical HTTP request, for example, a calculation that takes 20 minutes, this cannot be donewith the standard usage.When the evaluateQueued tag is processed, webMathematica creates a job object that waits ina queue until a kernel is available to do the calculation and the HTTP request returns immediately,probably before the computation has even started. At some time in the future, therequest is run and any results are saved. The web client can make a request to the server,using an identifier for the job, at any time to find out what has happened to the request.webMathematica contains a simple example of the queuing system, the source for this can befound in the webMathematica web application in the directory Examples/Queueing (the full pathin Tomcat would be webapps/webMathematica/Examples/Queueing). There are three files,Start.jsp, which sets up parameters for the calculation, Submit.jsp, which actually submitsthe calculation to the queue, and Result.jsp, which waits for and displays the result.The basis of the queueing system is the evaluateQueued tag, which is used instead of theevaluate tag. An example of the tag is shown below.longCalculation[]The body of the tag contains the long running calculation, in this case longCalculation[].Note that if you load any package in this body, then you need to refer to the fully qualifiedname; this is discussed in more detail in the section Loading Packages. An alternative would behow to use the KernelInitializeCode configuration parameter to load any necessarypackages.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!