[Midas] module plan

Michael Grauer michael.grauer at kitware.com
Wed Jul 4 17:57:29 EDT 2012


Hi Mona,

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.

answers inline



On Tue, Jul 3, 2012 at 6:24 PM, Mona Wong <mona at sdsc.edu> wrote:

>
> Hi Midas:
>
>         I'm hoping to get some advice on how I should proceed with the
> following:
>
>         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.
>
>
-use the GlobalController.getTempDirectory() method for the dir
-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)





>         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.
>
>
-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.

Here is some javascript code from the challenge plugin (not packaged with
midas, but available via github at
https://github.com/midasplatform/challenge ) to do this

<code>

var delayMillis = 10000;

midas.challenge.competitor.updateResults = function()
  {
  ajaxWebApi.ajax(
    {
    method: 'midas.challenge.competitor.list.results',
    args: 'resultsRunId=' + json.resultsRunId,
    success: function(results)
      {
      var processingComplete = results.data.processing_complete;
      var resultsRows = results.data.results_rows;
      midas.challenge.competitor.updateResultsTable(resultsRows);
      if(processingComplete !== 'true')
        {
        var t = setTimeout(midas.challenge.competitor.updateResults,
delayMillis);
        }
      },
      error: function() {}
    });
  }



$(document).ready(function()
  {

    // start looping for updates
    var t = setTimeout(midas.challenge.competitor.updateResults,
delayMillis);
  });
</code>

-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.




>         3.  Annio will retrieve the generated files as needed via a call
> back to the Midas server (maybe via web API).
>
>
I'm not sure what you need done here, but you can push or pull files
to/from Midas via the web API.


Thanks,
Mike



>         Is there documentation or module I can use or copy/edit to achieve
> the steps above?
>
> thanks,
> Mona
>
>
> *********************************************
>     Mona Wong
>     Web & iPad Application Developer
>     San Diego Supercomputer Center
>
>     You are the light you wish to see.
> *********************************************
>
>
>
> _______________________________________________
> Midas mailing list
> Midas at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/midas
>



-- 
Thanks,
Michael Grauer
R & D Engineer
Kitware, Inc.
919 969 6990 x322
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20120704/ea462416/attachment.html>


More information about the Midas mailing list