user:code:wrapper [Promethee]

Computing code wrapping

In case your code is not supported, you can build your own wrapper. The wrapper holds two components: one for Promethee daemon side, used to support code execution on computing server, the other on GUI side to support for user ergonomics issues with this code.

Daemon side wrapping

  1. The first step is to build a robust and efficient script to launch your code on the calculation server running Promethee daemon. This script will be launched by Promethee daemon when any authorized Promethee GUI will ask for this code. This script will basically hold these features:
    • environment variables setting needed for code running,
    • pre-processing of running directory, for instance create directory, move files insides, apply dos2unix command on input files, etc…
    • post-processing of code output for easier parsing by Promethee (grep, awk, sed, …)
    • cleaning of directory after calculation is done to suppress big files
    • support for efficient kill of running calculation (in case the connected GUI asked it for instance):
      • if your script creates a “PID” file, all integers written inside will be used as arguments for “taskkill” or “kill -9” commands
      • if your script creates a KILL.bat or file, it will be launched
  2. Once this script is available and tested, you have to modify the Promethee daemon configuration in the “calculator.xml” file holding:
    • the list of hosts and network port allowed for users to run calculations: each HOST element containes:
      • the network name of the user computer where graphical interface is installed (IP address or hostname)
      • a port of this computer, waiting for Promethee service (commonly 8001 8002, or 8003)
        Note that the same network name can be used in different HOST elements.
    • the list of codes available on the server. Each CODE elements contain:
      • the name of the code to launch
      • the shell command used to launch code 1)
      • optionally, a plugin for better support of code startup, error, kill or running status report.
Finally, the calculator.xml file lists all hosts and codes in this format:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<CALCULATOR spool="/tmp" port="10000" >
     <HOST name="123.456.780" port="8001" />
     <HOST name="123.456.780" port="8002" />
     <HOST name="123.456.781" port="8001" />
     <HOST name="123.456.781" port="8002" />
     <HOST name="123.456.782" port="8001" />
     <HOST name="123.456.782" port="8002" />
     <HOST name="123.456.782" port="8003" />
     <CODE command="cristal.v1.2 -p" name="Cristal_1.2" />
     <CODE command="mcnp_inp=" name="MCNP" />
So you just have to add the following line to add the code your are wrapping, available thanks to the previously created script: myscript.bat:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<CALCULATOR spool="/tmp" port="10000" >
     <CODE command="myscript.bat" name="NameOfTheCode" />
You don't need to restart Promethee daemon, if it is already started, the change in calculator.xml file will be taken into account in the next 5 seconds.

GUI side wrapping

Once this script is built and “caculator.xml” file is properly configured on daemon side, two levels of wrapping on GUI side are available:
    • simple user interface providing input ASCII dataset parametrization, colorizing, comment support, search, autocomplete …
    • simple script features to access ASCII code output (grep, cut, …)
    • estimated time to development: < 20 hours
  • extended code wrapping providing optionnal extensions:
    • extention of user interface input editor (graphical viewer)
    • optional sandbox and pre-loading of formulas to extend input modeling capabilities,
    • code running progress information report,
    • more flexible parsing of code output files (binary, XML, more complicated ASCII, …)
    • estimated time to development: < 100 hours
1) Do not use shell alias, prefer an extended call: /path/to/my/code/ instead
© IRSN - All right reserved - Legal information