Hi Mona,<div><br></div><div>This is a lot to cover and I don't want to get lost in the details. I think it is best for me to give general advice for these, then you can ask follow up questions when you get to the different parts.</div>
<div><br></div><div>answers inline</div><div><br></div><div><br><br><div class="gmail_quote">On Tue, Jul 3, 2012 at 6:24 PM, Mona Wong <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Midas:<br>
<br>
I'm hoping to get some advice on how I should proceed with the following:<br>
<br>
1. From my module, create a temporary directory somewhere, and launch a python script on the server to start some backend processing. This python script will create a bunch of files (a JSON and bunch of PNG files) in the temporary directory.<br>
<br></blockquote><div><br></div><div>-use the GlobalController.getTempDirectory() method for the dir</div><div>-use php's exec to launch your python script (you can see examples of this in the batchmake module, modules/batchmake/controllers/components/KWBatchmakeComponent.php, look in the condorSubmitDag method, with calls of KWUtils::prepareExecCommand and KWUtils::exec)</div>
<div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2. When the python script is done, signal Midas (maybe via a controller?) which then will need to gather information about the temporary generated files, launch my web app (Annio), and pass the gathered information to Annio.<br>
<br></blockquote><div><br></div><div>-you'll probably need to poll Midas for the signal that the script is done. so you can go to some kind of status page which has some ajax/javascript that repeatedly calls a particular API or controller ajax method to see if the condition is reached.</div>
<div><br></div><div>Here is some javascript code from the challenge plugin (not packaged with midas, but available via github at <a href="https://github.com/midasplatform/challenge">https://github.com/midasplatform/challenge</a> ) to do this</div>
<div><br></div><div><code></div><div><div><br></div><div>var delayMillis = 10000;</div><div><br></div><div>midas.challenge.competitor.updateResults = function()</div><div> {</div><div> ajaxWebApi.ajax(</div><div> {</div>
<div> method: 'midas.challenge.competitor.list.results', </div><div> args: 'resultsRunId=' + json.resultsRunId,</div><div> success: function(results) </div><div> {</div><div> var processingComplete = results.data.processing_complete;</div>
<div> var resultsRows = results.data.results_rows;</div><div> midas.challenge.competitor.updateResultsTable(resultsRows);</div><div> if(processingComplete !== 'true') </div><div> { </div><div>
var t = setTimeout(midas.challenge.competitor.updateResults, delayMillis);</div><div> }</div><div> },</div><div> error: function() {}</div><div> });</div><div> }</div><div><br></div><div><br></div>
<div><br></div><div>$(document).ready(function() </div><div> { </div><div> </div><div> // start looping for updates</div><div> var t = setTimeout(midas.challenge.competitor.updateResults, delayMillis);</div><div>
});</div><div></code></div><div></div><div> </div></div><div>-when your python script is finished, it can use the Pydas library to signal Midas of the completion, via some API method you can add in your module, then your ajax code will get this signal (processingComplete in my javascript example code) and do the next action.</div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3. Annio will retrieve the generated files as needed via a call back to the Midas server (maybe via web API).<br>
<br>
</blockquote><div><br></div><div>I'm not sure what you need done here, but you can push or pull files to/from Midas via the web API.</div><div><br></div><div><br></div><div>Thanks,</div><div>Mike</div><div><br></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Is there documentation or module I can use or copy/edit to achieve the steps above?<br>
<br>
thanks,<br>
Mona<br>
<br>
<br>
*********************************************<br>
Mona Wong<br>
Web & iPad Application Developer<br>
San Diego Supercomputer Center<br>
<br>
You are the light you wish to see.<br>
*********************************************<br>
<br>
<br>
<br>
_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>Michael Grauer<br>R & D Engineer<br>Kitware, Inc.<br>919 969 6990 x322<br><br><br><br>
</div>